├── Assets ├── CVVTuberExample │ ├── ReadMe.pdf │ ├── CVVTuberExample.unity │ ├── ShowOpenCVLicense.unity │ ├── CVVTuber │ │ ├── Prefabs │ │ │ ├── LookAtRoot.prefab │ │ │ ├── CameraController.prefab │ │ │ ├── OpenCVFaceRectGetter.prefab │ │ │ ├── DlibFaceLandmarkGetter.prefab │ │ │ ├── HeadLookAtIKController.prefab │ │ │ ├── HeadRotationController.prefab │ │ │ ├── FaceBlendShapeController.prefab │ │ │ ├── MultiSourceMatSourceGetter.prefab │ │ │ ├── VideoCaptureMatSourceGetter.prefab │ │ │ ├── WebCamTextureMatSourceGetter.prefab │ │ │ ├── FaceLandmarkHeadPositionAndRotationGetter.prefab │ │ │ ├── DlibFaceLandmarkGetter.prefab.meta │ │ │ ├── OpenCVFaceRectGetter.prefab.meta │ │ │ ├── MultiSourceMatSourceGetter.prefab.meta │ │ │ ├── VideoCaptureMatSourceGetter.prefab.meta │ │ │ ├── WebCamTextureMatSourceGetter.prefab.meta │ │ │ ├── FaceLandmarkHeadPositionAndRotationGetter.prefab.meta │ │ │ ├── LookAtRoot.prefab.meta │ │ │ ├── CameraController.prefab.meta │ │ │ ├── FaceBlendShapeController.prefab.meta │ │ │ ├── HeadLookAtIKController.prefab.meta │ │ │ └── HeadRotationController.prefab.meta │ │ ├── Addons │ │ │ ├── VRMCVVTuber.unitypackage │ │ │ ├── VRM10CVVTuber.unitypackage │ │ │ ├── UnityChanCVVTuber.unitypackage │ │ │ ├── Live2DCubism5CVVTuber.unitypackage │ │ │ ├── VRM10CVVTuber.unitypackage.meta │ │ │ ├── Live2DCubism5CVVTuber.unitypackage.meta │ │ │ ├── VRMCVVTuber.unitypackage.meta │ │ │ └── UnityChanCVVTuber.unitypackage.meta │ │ ├── Scripts │ │ │ ├── Core │ │ │ │ ├── IFaceRectGetter.cs │ │ │ │ ├── IHeadPositionGetter.cs │ │ │ │ ├── IFaceLandmarkGetter.cs │ │ │ │ ├── IHeadRotationGetter.cs │ │ │ │ ├── IMatSourceGetter.cs │ │ │ │ ├── IFaceRectGetter.cs.meta │ │ │ │ ├── IMatSourceGetter.cs.meta │ │ │ │ ├── IFaceLandmarkGetter.cs.meta │ │ │ │ ├── IHeadPositionGetter.cs.meta │ │ │ │ ├── IHeadRotationGetter.cs.meta │ │ │ │ ├── CVVTuberProcessOrderList.cs.meta │ │ │ │ ├── FaceAnimationController.cs.meta │ │ │ │ ├── InterfaceRestrictionAttribute.cs.meta │ │ │ │ ├── CVVTuberProcess.cs.meta │ │ │ │ ├── CVVTuberControllManager.cs.meta │ │ │ │ ├── InterfaceRestrictionAttribute.cs │ │ │ │ ├── CVVTuberProcessOrderList.cs │ │ │ │ ├── CVVTuberProcess.cs │ │ │ │ ├── CVVTuberControllManager.cs │ │ │ │ └── FaceAnimationController.cs │ │ │ ├── Core.meta │ │ │ ├── AnimatorController.meta │ │ │ ├── CameraController.meta │ │ │ ├── CameraController │ │ │ │ ├── CameraTouchController.cs.meta │ │ │ │ └── CameraTouchController.cs │ │ │ ├── DlibFaceLandmarkGetter.cs.meta │ │ │ ├── FaceBlendShapeController.cs.meta │ │ │ ├── HeadLookAtIKController.cs.meta │ │ │ ├── HeadRotationController.cs.meta │ │ │ ├── OpenCVFaceRectGetter.cs.meta │ │ │ ├── MultiSourceMatSourceGetter.cs.meta │ │ │ ├── VideoCaptureMatSourceGetter.cs.meta │ │ │ ├── WebCamTextureMatSourceGetter.cs.meta │ │ │ ├── FaceLandmarkHeadPositionAndRotationGetter.cs.meta │ │ │ ├── AnimatorController │ │ │ │ ├── AnimatorLookAtIKController.cs.meta │ │ │ │ └── AnimatorLookAtIKController.cs │ │ │ ├── FaceBlendShapeController.cs │ │ │ ├── HeadRotationController.cs │ │ │ ├── HeadLookAtIKController.cs │ │ │ ├── MultiSourceMatSourceGetter.cs │ │ │ ├── WebCamTextureMatSourceGetter.cs │ │ │ ├── VideoCaptureMatSourceGetter.cs │ │ │ ├── OpenCVFaceRectGetter.cs │ │ │ ├── DlibFaceLandmarkGetter.cs │ │ │ └── FaceLandmarkHeadPositionAndRotationGetter.cs │ │ ├── CVVTuberModel │ │ │ ├── Models │ │ │ │ ├── CVVTuberModel.fbx │ │ │ │ ├── Materials │ │ │ │ │ ├── No Name.mat │ │ │ │ │ ├── Material.mat │ │ │ │ │ ├── No Name.mat.meta │ │ │ │ │ └── Material.mat.meta │ │ │ │ └── Materials.meta │ │ │ ├── Materials │ │ │ │ ├── CVVTuber_body.mat │ │ │ │ ├── CVVTuber_face.mat │ │ │ │ ├── CVVTuber_body_SRP.mat.meta │ │ │ │ ├── CVVTuber_face_SRP.mat.meta │ │ │ │ ├── CVVTuber_body.mat.meta │ │ │ │ ├── CVVTuber_face.mat.meta │ │ │ │ ├── CVVTuber_body_SRP.mat │ │ │ │ └── CVVTuber_face_SRP.mat │ │ │ ├── Prefabs │ │ │ │ ├── CVVTuberModel.prefab │ │ │ │ └── CVVTuberModel.prefab.meta │ │ │ ├── Textures │ │ │ │ ├── CVVTuberModel_face.png │ │ │ │ └── CVVTuberModel_face.png.meta │ │ │ ├── Animations │ │ │ │ └── CVVTuberModel_Idle.fbx │ │ │ ├── Animators │ │ │ │ ├── CVVTuberAnimatorController.controller │ │ │ │ └── CVVTuberAnimatorController.controller.meta │ │ │ ├── Models.meta │ │ │ ├── Prefabs.meta │ │ │ ├── Textures.meta │ │ │ ├── Animations.meta │ │ │ ├── Animators.meta │ │ │ └── Materials.meta │ │ ├── Addons.meta │ │ ├── Editor.meta │ │ ├── Prefabs.meta │ │ ├── Scripts.meta │ │ ├── Examples.meta │ │ ├── CVVTuberModel.meta │ │ ├── Examples │ │ │ ├── FpsMonitor.meta │ │ │ ├── FpsMonitor │ │ │ │ ├── Resources.meta │ │ │ │ ├── Resources │ │ │ │ │ ├── FpsMonitorCanvas_104.prefab.meta │ │ │ │ │ └── FpsMonitorCanvas_104.prefab │ │ │ │ ├── FpsMonitor.cs.meta │ │ │ │ └── FpsMonitor.cs │ │ │ ├── MultiSourceCVVTuberExample.meta │ │ │ ├── MultiSourceCVVTuberExample │ │ │ │ ├── VideoCaptureCVVTuberExample_SRP.unity │ │ │ │ ├── WebCamTextureCVVTuberExample_SRP.unity │ │ │ │ ├── VideoCaptureCVVTuberExample_Built-in.unity │ │ │ │ ├── WebCamTextureCVVTuberExample_Built-in.unity │ │ │ │ ├── VideoCaptureCVVTuberExample_SRP.unity.meta │ │ │ │ ├── VideoCaptureCVVTuberExample_Built-in.unity.meta │ │ │ │ ├── WebCamTextureCVVTuberExample_SRP.unity.meta │ │ │ │ ├── WebCamTextureCVVTuberExample_Built-in.unity.meta │ │ │ │ ├── MultiSourceCVVTuberExample.cs.meta │ │ │ │ └── MultiSourceCVVTuberExample.cs │ │ │ ├── InputModuleSwitcher.cs.meta │ │ │ └── InputModuleSwitcher.cs │ │ └── Editor │ │ │ ├── CVVTuberExampleMenuItem.cs.meta │ │ │ ├── InterfaceRestrictionDrawer.cs.meta │ │ │ ├── CVVTuberProcessOrderListEditor.cs.meta │ │ │ ├── InterfaceRestrictionDrawer.cs │ │ │ ├── CVVTuberProcessOrderListEditor.cs │ │ │ └── CVVTuberExampleMenuItem.cs │ ├── CVVTuber.meta │ ├── ReadMe.pdf.meta │ ├── CVVTuberExample.unity.meta │ ├── ShowOpenCVLicense.unity.meta │ ├── CVVTuberExample.cs.meta │ ├── ShowOpenCVLicense.cs.meta │ ├── ShowOpenCVLicense.cs │ └── CVVTuberExample.cs └── CVVTuberExample.meta └── README.md /Assets/CVVTuberExample/ReadMe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/ReadMe.pdf -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuberExample.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuberExample.unity -------------------------------------------------------------------------------- /Assets/CVVTuberExample/ShowOpenCVLicense.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/ShowOpenCVLicense.unity -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/LookAtRoot.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/LookAtRoot.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/VRMCVVTuber.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Addons/VRMCVVTuber.unitypackage -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/CameraController.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/CameraController.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/VRM10CVVTuber.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Addons/VRM10CVVTuber.unitypackage -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/OpenCVFaceRectGetter.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/OpenCVFaceRectGetter.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/UnityChanCVVTuber.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Addons/UnityChanCVVTuber.unitypackage -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/DlibFaceLandmarkGetter.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/DlibFaceLandmarkGetter.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/HeadLookAtIKController.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/HeadLookAtIKController.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/HeadRotationController.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/HeadRotationController.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IFaceRectGetter.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace CVVTuber 3 | { 4 | public interface IFaceRectGetter 5 | { 6 | UnityEngine.Rect GetFaceRect(); 7 | } 8 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/CVVTuberModel.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/CVVTuberModel.fbx -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/FaceBlendShapeController.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/FaceBlendShapeController.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/Live2DCubism5CVVTuber.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Addons/Live2DCubism5CVVTuber.unitypackage -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_body.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_body.mat -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_face.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_face.mat -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials/No Name.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials/No Name.mat -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Prefabs/CVVTuberModel.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Prefabs/CVVTuberModel.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/MultiSourceMatSourceGetter.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/MultiSourceMatSourceGetter.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/VideoCaptureMatSourceGetter.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/VideoCaptureMatSourceGetter.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials/Material.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials/Material.mat -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Textures/CVVTuberModel_face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Textures/CVVTuberModel_face.png -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/WebCamTextureMatSourceGetter.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/WebCamTextureMatSourceGetter.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animations/CVVTuberModel_Idle.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animations/CVVTuberModel_Idle.fbx -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IHeadPositionGetter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CVVTuber 4 | { 5 | public interface IHeadPositionGetter 6 | { 7 | Vector3 GetHeadPosition(); 8 | } 9 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0db62515790515a44859dc742bb1379f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/FaceLandmarkHeadPositionAndRotationGetter.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Prefabs/FaceLandmarkHeadPositionAndRotationGetter.prefab -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c40fa6a5570c714fb1c4beb6a509fb4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f831444943d7e994fb50472912ee33e8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31c54f98aabe45849b1035d3de9c98f0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e1b93c6094450e45a4cc22df2f1462a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/ReadMe.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d294d76df0ab8645ada23aa9bc428ce 3 | timeCreated: 1525564670 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/VRM10CVVTuber.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a69837c49d711b74a8e12efc5cb6cf89 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animators/CVVTuberAnimatorController.controller: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animators/CVVTuberAnimatorController.controller -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a06257c8a76090a47a65a5356a0a6535 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6133e6b71755bf646ba8920834756aca 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b21a95ab27d28447b01069aeece2c91 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuberExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c74a8a104a6b5cf448c2515254b9cfd7 3 | timeCreated: 1525437608 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/ShowOpenCVLicense.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b60dc199325bb9479589e73f931107f 3 | timeCreated: 1525442799 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/Live2DCubism5CVVTuber.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99d277639ef27c342839a79c50ce4404 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 12be997d9553e634b837a1757c073e68 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba09bf494bacb3146bd027829c69caff 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a12461db3c160284b81f1ea62cb09b2e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f3a7a4826a893747b2994dcb5441f25 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animations.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8e6f11e6436d0444b8e49692fcd4682 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animators.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bc0185f349aaad4e9e62608ad825607 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13d0dd28ddf247443bcfb980d2b2a013 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/AnimatorController.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96d4bc60a4568014eab3793f0b10bbcd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/CameraController.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d53e6f95a1ddbf44b9c633fa1099fab 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58dcf3f06c674da4d8c629ca533d156c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d1d64c5115a7364dac445c4931c601c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/VRMCVVTuber.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dabf728ab5e34c44c9a21ee189db8b5a 3 | timeCreated: 1528290279 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor/Resources/FpsMonitorCanvas_104.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bcb07d5d96bdfc4bb3fa54287e47935 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 349ffc5c89f57e84980b792b7b69bdb9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/VideoCaptureCVVTuberExample_SRP.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/VideoCaptureCVVTuberExample_SRP.unity -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/WebCamTextureCVVTuberExample_SRP.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/WebCamTextureCVVTuberExample_SRP.unity -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Addons/UnityChanCVVTuber.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 957c38c3fbec12b4185fb5275d18af34 3 | timeCreated: 1528011514 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/VideoCaptureCVVTuberExample_Built-in.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/VideoCaptureCVVTuberExample_Built-in.unity -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/WebCamTextureCVVTuberExample_Built-in.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/CVVTuberExample/HEAD/Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/WebCamTextureCVVTuberExample_Built-in.unity -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/DlibFaceLandmarkGetter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 800036fcb102d86428382f7c2b2ef375 3 | timeCreated: 1525429801 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/OpenCVFaceRectGetter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af6957589cb1a6347b98cd2c9c243209 3 | timeCreated: 1525429789 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IFaceLandmarkGetter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace CVVTuber 5 | { 6 | public interface IFaceLandmarkGetter 7 | { 8 | List GetFaceLanmarkPoints(); 9 | } 10 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2381c3e4ce24da34daef8b8fa4795c69 3 | folderAsset: yes 4 | timeCreated: 1524324630 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/VideoCaptureCVVTuberExample_SRP.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c348756442713ef4ba7cc547f13c8852 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/MultiSourceMatSourceGetter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0309930e883f82545a11b4e78f709e99 3 | timeCreated: 1525429804 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/VideoCaptureMatSourceGetter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6db1fc71fe0546c46b68f208c0a1488e 3 | timeCreated: 1525429793 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/WebCamTextureMatSourceGetter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e41cddd650666714ba847b8e75dd4489 3 | timeCreated: 1525429804 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IHeadRotationGetter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CVVTuber 4 | { 5 | public interface IHeadRotationGetter 6 | { 7 | Quaternion GetHeadRotation(); 8 | 9 | Vector3 GetHeadEulerAngles(); 10 | } 11 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/VideoCaptureCVVTuberExample_Built-in.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dac7777addf6a9446881b76fc852c767 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_body_SRP.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4422d01a2be9916478ae54d300178f6d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_face_SRP.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03dfd3494ff1f5644a9507efbd5362d0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/FaceLandmarkHeadPositionAndRotationGetter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 275b3522b20c2264fb4bd9769f132f2a 3 | timeCreated: 1525429791 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/WebCamTextureCVVTuberExample_SRP.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2d85c7654a1aac4ba727ec24044bfd0 3 | timeCreated: 1525427481 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/LookAtRoot.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f48cde3504f40db40aaa076341561f75 3 | timeCreated: 1528355091 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/WebCamTextureCVVTuberExample_Built-in.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3547b45d3a670fa428bb50c330c318c6 3 | timeCreated: 1525427481 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/CameraController.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80e65ea450e85bc4aa097ae4754f82d0 3 | timeCreated: 1528289435 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_body.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9661fbc117a04f489a4985da9ae31c2 3 | timeCreated: 1528899334 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_face.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e2699dfd310a8545b76f1231d2c150f 3 | timeCreated: 1528899334 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials/No Name.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 309ac4ce3519d2a4e957a94962d78d2f 3 | timeCreated: 1528959505 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/FaceBlendShapeController.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddcc0e2e8b32afb43a30f8095f00e079 3 | timeCreated: 1528741769 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/HeadLookAtIKController.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f41067d38df7af04ca35a8e6d25719a7 3 | timeCreated: 1528427034 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Prefabs/HeadRotationController.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d1dac9541dfae94f91414063567bb93 3 | timeCreated: 1528158507 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IMatSourceGetter.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.CoreModule; 2 | 3 | namespace CVVTuber 4 | { 5 | public interface IMatSourceGetter 6 | { 7 | Mat GetMatSource(); 8 | 9 | Mat GetDownScaleMatSource(); 10 | 11 | float GetDownScaleRatio(); 12 | } 13 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Models/Materials/Material.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e8459d1d59c84e4b893f0167e65272e 3 | timeCreated: 1528959505 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Prefabs/CVVTuberModel.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 847b6607c87aa5a48b94beebccb013b2 3 | timeCreated: 1528899500 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Animators/CVVTuberAnimatorController.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86b0dd7a4707ba540972e6f2dea3f83d 3 | timeCreated: 1528236817 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 9100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/InputModuleSwitcher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5283d8f4196a86e418cc77c60c8a18dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor/FpsMonitor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31f095f870e3a054f81e558094da394e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuberExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfd76590dc929594e8ed51d4ed373533 3 | timeCreated: 1525437608 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/ShowOpenCVLicense.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5e0d654205c73146a8cb140ab0a428f 3 | timeCreated: 1525442799 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IFaceRectGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0697526bf9ca6194594980ebd0ea115a 3 | timeCreated: 1549013234 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IMatSourceGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d305eaa1ae1547746a66e4e3b849392d 3 | timeCreated: 1549010360 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor/CVVTuberExampleMenuItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bed8a7febb928644ebbd34d89b2e0402 3 | timeCreated: 1525381163 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor/InterfaceRestrictionDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 319eb0b162da7554290c8beef97e9cd0 3 | timeCreated: 1549139711 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IFaceLandmarkGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 218a35582a62711498633ddd9a9d0c5b 3 | timeCreated: 1549011737 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IHeadPositionGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59b3bc7c7522f324eacecc7a50167bf4 3 | timeCreated: 1549013721 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/IHeadRotationGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1ebe6f03105b4a429d85b5a809e3ff1 3 | timeCreated: 1549013721 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor/CVVTuberProcessOrderListEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 647a214e62ce51d49aed89ef397b3807 3 | timeCreated: 1528517831 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberProcessOrderList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04bcf75c4b76ce8489246095defc65fc 3 | timeCreated: 1528517787 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/FaceAnimationController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82041e40b49f6824ca872cda96f6cf9f 3 | timeCreated: 1548939682 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/InterfaceRestrictionAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b3d14a5daabe2349990a8eee135d01c 3 | timeCreated: 1549139631 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/CameraController/CameraTouchController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c853ca9e30883fb4ebcfbcc3344c372e 3 | timeCreated: 1525419507 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberProcess.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e1622d4ca9fbe44b92ac2df69e2d21f 3 | timeCreated: 1524504813 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/DlibFaceLandmarkGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c6387cc9e16f65429513704270fc386 3 | timeCreated: 1524326362 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/FaceBlendShapeController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2510582b8a76fdc47a48564aed5ca971 3 | timeCreated: 1524329232 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/HeadLookAtIKController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5b34a6291cca9f40ad0b582150f5221 3 | timeCreated: 1524578122 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/HeadRotationController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb26c2384bbac714b82ff3bccd4fd270 3 | timeCreated: 1524578122 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/OpenCVFaceRectGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bfc56f41af411f4e8214af8573c49a3 3 | timeCreated: 1524326362 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/MultiSourceCVVTuberExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84025deff94614a46b348d7f0ae41ba8 3 | timeCreated: 1525443695 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberControllManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5479bed6271ca8348a5be5e378aab328 3 | timeCreated: 1524561755 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/MultiSourceMatSourceGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60f09a93d08f84c4dbd37e3d92c8fd2c 3 | timeCreated: 1524381647 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/VideoCaptureMatSourceGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb71b6daf32a0aa4ea9d130644e9f8ed 3 | timeCreated: 1524387965 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/WebCamTextureMatSourceGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3ab66b9126abdf49a385eb521fced7e 3 | timeCreated: 1524381647 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/FaceLandmarkHeadPositionAndRotationGetter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a3c6e7668cf24a40b531635270b0bcd 3 | timeCreated: 1524329232 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/AnimatorController/AnimatorLookAtIKController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25eb80662a47acd4f820001aa591ed82 3 | timeCreated: 1524682853 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/InterfaceRestrictionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace CVVTuber 5 | { 6 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 7 | public class InterfaceRestrictionAttribute : PropertyAttribute 8 | { 9 | public Type type; 10 | 11 | public InterfaceRestrictionAttribute(Type type) 12 | { 13 | this.type = type; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberProcessOrderList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace CVVTuber 5 | { 6 | [DisallowMultipleComponent] 7 | public class CVVTuberProcessOrderList : MonoBehaviour 8 | { 9 | [SerializeField] 10 | List processOrderList = default(List); 11 | 12 | public List GetProcessOrderList() 13 | { 14 | return processOrderList; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/ShowOpenCVLicense.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.SceneManagement; 3 | 4 | namespace CVVTuberExample 5 | { 6 | /// 7 | /// Show License 8 | /// 9 | public class ShowOpenCVLicense : MonoBehaviour 10 | { 11 | // Use this for initialization 12 | void Start() 13 | { 14 | 15 | } 16 | 17 | // Update is called once per frame 18 | void Update() 19 | { 20 | 21 | } 22 | 23 | /// 24 | /// Raises the back button click event. 25 | /// 26 | public void OnBackButtonClick() 27 | { 28 | SceneManager.LoadScene("CVVTuberExample"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CV VTuber Example 2 | ==================== 3 | 4 | Overview 5 | ----- 6 | [https://assetstore.unity.com/packages/templates/tutorials/cv-vtuber-example-118186](https://assetstore.unity.com/packages/templates/tutorials/cv-vtuber-example-118186?aid=1011l4ehR) 7 | 8 | Environment 9 | ----- 10 | [OpenCVForUnity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 11 | [DlibFaceLandmarkDetector](https://assetstore.unity.com/packages/tools/integration/dlib-facelandmark-detector-64314?aid=1011l4ehR) 12 | 13 | Demo Video 14 | ----- 15 | [![](http://img.youtube.com/vi/yGNVo3lT6ws/0.jpg)](https://www.youtube.com/watch?v=yGNVo3lT6ws) 16 | 17 | 18 | Demo 19 | ----- 20 | - WebGL (simd) 21 | - Android 22 | 23 | Manual 24 | ----- 25 | [ReadMe.pdf](/Assets/CVVTuberExample/ReadMe.pdf) 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/AnimatorController/AnimatorLookAtIKController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CVVTuber 4 | { 5 | public class AnimatorLookAtIKController : MonoBehaviour 6 | { 7 | public Animator animator; 8 | 9 | public Transform looktAtTarget; 10 | 11 | [Range(0, 1.0f)] 12 | public float weight = 1.0f; 13 | 14 | [Range(0, 1.0f)] 15 | public float bodyWeight = 0.5f; 16 | 17 | [Range(0, 1.0f)] 18 | public float headWeight = 0.0f; 19 | 20 | [Range(0, 1.0f)] 21 | public float eyesWeightt = 0.5f; 22 | 23 | [Range(0, 1.0f)] 24 | public float clampWeight = 0.0f; 25 | 26 | protected virtual void Start() 27 | { 28 | this.animator = GetComponent(); 29 | } 30 | 31 | protected virtual void OnAnimatorIK(int layerIndex) 32 | { 33 | if (animator != null) 34 | { 35 | this.animator.SetLookAtWeight(weight, bodyWeight, headWeight, eyesWeightt, clampWeight); 36 | this.animator.SetLookAtPosition(looktAtTarget.position); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor/InterfaceRestrictionDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace CVVTuber 5 | { 6 | [CustomPropertyDrawer(typeof(InterfaceRestrictionAttribute))] 7 | public class InterfaceRestrictionDrawer : PropertyDrawer 8 | { 9 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 10 | { 11 | var restriction = (InterfaceRestrictionAttribute)attribute; 12 | 13 | if (property.propertyType == SerializedPropertyType.ObjectReference) 14 | { 15 | 16 | if (property.objectReferenceValue != null) 17 | { 18 | 19 | System.Type type = property.objectReferenceValue.GetType(); 20 | if (type.GetInterface(restriction.type.ToString()) == null) 21 | { 22 | property.objectReferenceValue = null; 23 | } 24 | } 25 | EditorGUI.ObjectField(position, property, new GUIContent(ObjectNames.NicifyVariableName(property.name) + " (" + restriction.type.Name + ")")); 26 | 27 | } 28 | else 29 | { 30 | EditorGUI.PropertyField(position, property); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/InputModuleSwitcher.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | #if ENABLE_INPUT_SYSTEM 4 | using UnityEngine.InputSystem.UI; 5 | #endif 6 | 7 | namespace CVVTuberExample 8 | { 9 | /// 10 | /// Input Module Switcher that automatically configures the appropriate Input Module based on the input system being used. 11 | /// 12 | [RequireComponent(typeof(EventSystem))] 13 | public class InputModuleSwitcher : MonoBehaviour 14 | { 15 | private void Awake() 16 | { 17 | SetupInputSystem(); 18 | } 19 | 20 | private void SetupInputSystem() 21 | { 22 | var eventSystem = GetComponent(); 23 | if (eventSystem == null) 24 | return; 25 | 26 | #if ENABLE_INPUT_SYSTEM 27 | // Remove old Input Module if it exists 28 | var oldInput = eventSystem.GetComponent(); 29 | if (oldInput != null) 30 | { 31 | Destroy(oldInput); 32 | } 33 | 34 | // Add new Input Module if it doesn't exist 35 | if (eventSystem.GetComponent() == null) 36 | { 37 | eventSystem.gameObject.AddComponent(); 38 | } 39 | #endif 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/MultiSourceCVVTuberExample/MultiSourceCVVTuberExample.cs: -------------------------------------------------------------------------------- 1 | using CVVTuber; 2 | using UnityEngine; 3 | using UnityEngine.SceneManagement; 4 | 5 | namespace CVVTuberExample 6 | { 7 | public class MultiSourceCVVTuberExample : MonoBehaviour 8 | { 9 | /// 10 | /// The multi source mat source getter. 11 | /// 12 | public MultiSourceMatSourceGetter multiSourceMatSourceGetter; 13 | 14 | /// 15 | /// The dlib face landmark getter. 16 | /// 17 | public DlibFaceLandmarkGetter dlibFaceLandmarkGetter; 18 | 19 | // Use this for initialization 20 | void Start() 21 | { 22 | // Load global settings. 23 | dlibFaceLandmarkGetter.dlibShapePredictorFilePath = CVVTuberExample.dlibShapePredictorFilePath; 24 | dlibFaceLandmarkGetter.dlibShapePredictorMobileFilePath = CVVTuberExample.dlibShapePredictorFilePath; 25 | } 26 | 27 | /// 28 | /// Raises the back button click event. 29 | /// 30 | public void OnBackButtonClick() 31 | { 32 | SceneManager.LoadScene("CVVTuberExample"); 33 | } 34 | 35 | /// 36 | /// Raises the change camera button click event. 37 | /// 38 | public void OnChangeCameraButtonClick() 39 | { 40 | multiSourceMatSourceGetter.ChangeCamera(); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberProcess.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CVVTuber 4 | { 5 | public abstract class CVVTuberProcess : MonoBehaviour 6 | { 7 | public bool callInUnityLifeCycle; 8 | 9 | // Use this for initialization 10 | protected virtual void Start() 11 | { 12 | if (callInUnityLifeCycle) 13 | Setup(); 14 | } 15 | 16 | protected virtual void FixedUpdate() 17 | { 18 | if (callInUnityLifeCycle) 19 | FixedUpdateValue(); 20 | } 21 | 22 | // Update is called once per frame 23 | protected virtual void Update() 24 | { 25 | if (callInUnityLifeCycle) 26 | UpdateValue(); 27 | } 28 | 29 | // Update is called once per frame 30 | protected virtual void LateUpdate() 31 | { 32 | if (callInUnityLifeCycle) 33 | LateUpdateValue(); 34 | } 35 | 36 | protected virtual void OnDestroy() 37 | { 38 | Dispose(); 39 | } 40 | 41 | public virtual void Setup() 42 | { 43 | 44 | } 45 | 46 | public virtual void FixedUpdateValue() 47 | { 48 | 49 | } 50 | 51 | public virtual void UpdateValue() 52 | { 53 | 54 | } 55 | 56 | public virtual void LateUpdateValue() 57 | { 58 | 59 | } 60 | 61 | public virtual void Dispose() 62 | { 63 | 64 | } 65 | 66 | public virtual string GetDescription() 67 | { 68 | return ""; 69 | } 70 | 71 | protected virtual void NullCheck(System.Object obj, string name) 72 | { 73 | if (obj == null) 74 | NullWarning(name); 75 | } 76 | 77 | protected virtual void NullWarning(string name) 78 | { 79 | Debug.LogWarning("[" + this.GetType().FullName + "] " + name + " == null"); 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor/CVVTuberProcessOrderListEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEditorInternal; 3 | using UnityEngine; 4 | 5 | namespace CVVTuber 6 | { 7 | [CustomEditor(typeof(CVVTuberProcessOrderList), true)] 8 | public class CVVTuberProcessOrderListEditor : Editor 9 | { 10 | ReorderableList m_list; 11 | 12 | void OnEnable() 13 | { 14 | m_list = new ReorderableList( 15 | serializedObject, 16 | serializedObject.FindProperty("processOrderList") 17 | ); 18 | 19 | m_list.drawElementCallback += (rect, index, isActive, isFocused) => 20 | { 21 | 22 | var element = m_list.serializedProperty.GetArrayElementAtIndex(index); 23 | if (element != null) 24 | { 25 | rect.y += 2; 26 | 27 | if (element.objectReferenceValue == null) 28 | { 29 | EditorGUI.ObjectField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, new GUIContent((index + 1) + ". ")); 30 | } 31 | else 32 | { 33 | EditorGUI.ObjectField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, new GUIContent((index + 1) + ". " + ((CVVTuberProcess)element.objectReferenceValue).GetDescription())); 34 | } 35 | } 36 | }; 37 | 38 | m_list.drawHeaderCallback += (rect) => 39 | { 40 | EditorGUI.LabelField(rect, "Process Order List"); 41 | }; 42 | 43 | m_list.onAddCallback += (list) => 44 | { 45 | 46 | var prop = list.serializedProperty; 47 | 48 | prop.arraySize++; 49 | list.index = prop.arraySize - 1; 50 | var element = prop.GetArrayElementAtIndex(list.index); 51 | element.objectReferenceValue = null; 52 | }; 53 | } 54 | 55 | public override void OnInspectorGUI() 56 | { 57 | serializedObject.Update(); 58 | 59 | m_list.DoLayoutList(); 60 | 61 | serializedObject.ApplyModifiedProperties(); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Textures/CVVTuberModel_face.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79e2b22a03996c24cac7e81683c9a7d4 3 | timeCreated: 1528740016 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 512 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 512 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: Android 70 | maxTextureSize: 512 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: WebGL 78 | maxTextureSize: 512 79 | textureFormat: -1 80 | textureCompression: 1 81 | compressionQuality: 50 82 | crunchedCompression: 0 83 | allowsAlphaSplitting: 0 84 | overridden: 0 85 | spriteSheet: 86 | serializedVersion: 2 87 | sprites: [] 88 | outline: [] 89 | spritePackingTag: 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberControllManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace CVVTuber 6 | { 7 | [DisallowMultipleComponent, RequireComponent(typeof(CVVTuberProcessOrderList))] 8 | public class CVVTuberControllManager : MonoBehaviour 9 | { 10 | protected List processOrderList; 11 | 12 | // Use this for initialization 13 | protected virtual IEnumerator Start() 14 | { 15 | enabled = false; 16 | 17 | yield return null; 18 | 19 | processOrderList = GetComponent().GetProcessOrderList(); 20 | if (processOrderList == null) 21 | yield break; 22 | 23 | SetupAllProcess(); 24 | 25 | enabled = true; 26 | } 27 | 28 | // Update is called once per frame 29 | protected virtual void Update() 30 | { 31 | if (processOrderList == null) 32 | return; 33 | 34 | foreach (var item in processOrderList) 35 | { 36 | if (item == null) 37 | continue; 38 | 39 | if (!item.gameObject.activeInHierarchy || !item.enabled) 40 | continue; 41 | 42 | //Debug.Log("UpdateValue : " + item.gameObject.name); 43 | 44 | item.UpdateValue(); 45 | } 46 | } 47 | 48 | // Update is called once per frame 49 | protected virtual void LateUpdate() 50 | { 51 | if (processOrderList == null) 52 | return; 53 | 54 | foreach (var item in processOrderList) 55 | { 56 | if (item == null) 57 | continue; 58 | 59 | if (!item.gameObject.activeInHierarchy || !item.enabled) 60 | continue; 61 | 62 | //Debug.Log("LateUpdateValue : " + item.gameObject.name); 63 | 64 | item.LateUpdateValue(); 65 | } 66 | } 67 | 68 | protected virtual void OnDestroy() 69 | { 70 | Dispose(); 71 | } 72 | 73 | public virtual void Dispose() 74 | { 75 | 76 | } 77 | 78 | public virtual void SetupAllProcess() 79 | { 80 | if (processOrderList == null) 81 | return; 82 | 83 | foreach (var item in processOrderList) 84 | { 85 | if (item == null) 86 | continue; 87 | 88 | //Debug.Log("Setup : "+item.gameObject.name); 89 | 90 | item.Setup(); 91 | } 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/FaceBlendShapeController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace CVVTuber 5 | { 6 | public class FaceBlendShapeController : FaceAnimationController 7 | { 8 | [Header("[Target]")] 9 | 10 | public SkinnedMeshRenderer FACE_DEF; 11 | 12 | 13 | #region CVVTuberProcess 14 | 15 | public override string GetDescription() 16 | { 17 | return "Update face BlendShape using FaceLandmarkGetter."; 18 | } 19 | 20 | public override void LateUpdateValue() 21 | { 22 | if (FACE_DEF == null) 23 | return; 24 | 25 | if (enableEye) 26 | { 27 | FACE_DEF.SetBlendShapeWeight(0, EyeParam * 100); 28 | FACE_DEF.SetBlendShapeWeight(1, EyeParam * 100); 29 | } 30 | 31 | if (enableMouth) 32 | { 33 | if (MouthOpenParam >= 0.7f) 34 | { 35 | FACE_DEF.SetBlendShapeWeight(2, MouthOpenParam * 100); 36 | } 37 | else if (MouthOpenParam >= 0.25f) 38 | { 39 | FACE_DEF.SetBlendShapeWeight(2, MouthOpenParam * 80); 40 | } 41 | else 42 | { 43 | FACE_DEF.SetBlendShapeWeight(2, 0); 44 | } 45 | } 46 | } 47 | 48 | #endregion 49 | 50 | 51 | #region FaceAnimationController 52 | 53 | public override void Setup() 54 | { 55 | base.Setup(); 56 | 57 | NullCheck(FACE_DEF, "FACE_DEF"); 58 | } 59 | 60 | protected override void UpdateFaceAnimation(List points) 61 | { 62 | if (enableEye) 63 | { 64 | float eyeOpen = (GetLeftEyeOpenRatio(points) + GetRightEyeOpenRatio(points)) / 2.0f; 65 | //Debug.Log("eyeOpen " + eyeOpen); 66 | 67 | if (eyeOpen >= 0.4f) 68 | { 69 | eyeOpen = 1.0f; 70 | } 71 | else 72 | { 73 | eyeOpen = 0.0f; 74 | } 75 | EyeParam = Mathf.Lerp(EyeParam, 1 - eyeOpen, eyeLeapT); 76 | } 77 | 78 | if (enableMouth) 79 | { 80 | float mouthOpen = GetMouthOpenYRatio(points); 81 | //Debug.Log("mouthOpen " + mouthOpen); 82 | 83 | if (mouthOpen >= 0.7f) 84 | { 85 | mouthOpen = 1.0f; 86 | } 87 | else if (mouthOpen >= 0.25f) 88 | { 89 | mouthOpen = 0.5f; 90 | } 91 | else 92 | { 93 | mouthOpen = 0.0f; 94 | } 95 | MouthOpenParam = Mathf.Lerp(MouthOpenParam, mouthOpen, mouthLeapT); 96 | } 97 | } 98 | 99 | #endregion 100 | } 101 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/HeadRotationController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CVVTuber 4 | { 5 | public class HeadRotationController : CVVTuberProcess 6 | { 7 | [Header("[Input]")] 8 | 9 | [SerializeField, InterfaceRestriction(typeof(IHeadRotationGetter))] 10 | protected CVVTuberProcess headRotationGetter; 11 | 12 | protected IHeadRotationGetter _headRotationGetterInterface = null; 13 | 14 | protected IHeadRotationGetter headRotationGetterInterface 15 | { 16 | get 17 | { 18 | if (headRotationGetter != null && _headRotationGetterInterface == null) 19 | _headRotationGetterInterface = headRotationGetter.GetComponent(); 20 | return _headRotationGetterInterface; 21 | } 22 | } 23 | 24 | [Header("[Setting]")] 25 | 26 | public Vector3 offsetAngle; 27 | 28 | public bool invertXAxis; 29 | 30 | public bool invertYAxis; 31 | 32 | public bool invertZAxis; 33 | 34 | public bool rotateXAxis; 35 | 36 | public bool rotateYAxis; 37 | 38 | public bool rotateZAxis; 39 | 40 | public bool leapAngle; 41 | 42 | [Range(0, 1)] 43 | public float leapT = 0.6f; 44 | 45 | [Header("[Target]")] 46 | 47 | public Transform target; 48 | 49 | protected Vector3 headEulerAngles; 50 | 51 | protected Vector3 oldHeadEulerAngle; 52 | 53 | 54 | #region CVVTuberProcess 55 | 56 | public override string GetDescription() 57 | { 58 | return "Update head rotation of target transform using HeadRotationGetter."; 59 | } 60 | 61 | public override void Setup() 62 | { 63 | NullCheck(headRotationGetterInterface, "headRotationGetter"); 64 | 65 | if (target != null) 66 | { 67 | oldHeadEulerAngle = target.localEulerAngles; 68 | } 69 | else 70 | { 71 | NullWarning("target"); 72 | } 73 | } 74 | 75 | public override void LateUpdateValue() 76 | { 77 | if (headRotationGetterInterface == null) 78 | return; 79 | if (target == null) 80 | return; 81 | 82 | if (headRotationGetterInterface.GetHeadEulerAngles() != Vector3.zero) 83 | { 84 | headEulerAngles = headRotationGetterInterface.GetHeadEulerAngles(); 85 | 86 | headEulerAngles = new Vector3(headEulerAngles.x + offsetAngle.x, headEulerAngles.y + offsetAngle.y, headEulerAngles.z + offsetAngle.z); 87 | headEulerAngles = new Vector3(invertXAxis ? -headEulerAngles.x : headEulerAngles.x, invertYAxis ? -headEulerAngles.y : headEulerAngles.y, invertZAxis ? -headEulerAngles.z : headEulerAngles.z); 88 | headEulerAngles = Quaternion.Euler(rotateXAxis ? 90 : 0, rotateYAxis ? 90 : 0, rotateZAxis ? 90 : 0) * headEulerAngles; 89 | } 90 | 91 | if (leapAngle) 92 | { 93 | target.localEulerAngles = new Vector3(Mathf.LerpAngle(oldHeadEulerAngle.x, headEulerAngles.x, leapT), Mathf.LerpAngle(oldHeadEulerAngle.y, headEulerAngles.y, leapT), Mathf.LerpAngle(oldHeadEulerAngle.z, headEulerAngles.z, leapT)); 94 | } 95 | else 96 | { 97 | target.localEulerAngles = headEulerAngles; 98 | } 99 | 100 | oldHeadEulerAngle = target.localEulerAngles; 101 | } 102 | 103 | #endregion 104 | } 105 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_body_SRP.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: CVVTuber_body_SRP 11 | m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3} 12 | m_ValidKeywords: [] 13 | m_InvalidKeywords: [] 14 | m_LightmapFlags: 4 15 | m_EnableInstancingVariants: 0 16 | m_DoubleSidedGI: 0 17 | m_CustomRenderQueue: -1 18 | stringTagMap: 19 | RenderType: Opaque 20 | disabledShaderPasses: [] 21 | m_SavedProperties: 22 | serializedVersion: 3 23 | m_TexEnvs: 24 | - _BaseMap: 25 | m_Texture: {fileID: 0} 26 | m_Scale: {x: 1, y: 1} 27 | m_Offset: {x: 0, y: 0} 28 | - _BumpMap: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | - _DetailAlbedoMap: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - _DetailMask: 37 | m_Texture: {fileID: 0} 38 | m_Scale: {x: 1, y: 1} 39 | m_Offset: {x: 0, y: 0} 40 | - _DetailNormalMap: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | - _EmissionMap: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - _MainTex: 49 | m_Texture: {fileID: 0} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | - _MetallicGlossMap: 53 | m_Texture: {fileID: 0} 54 | m_Scale: {x: 1, y: 1} 55 | m_Offset: {x: 0, y: 0} 56 | - _OcclusionMap: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - _ParallaxMap: 61 | m_Texture: {fileID: 0} 62 | m_Scale: {x: 1, y: 1} 63 | m_Offset: {x: 0, y: 0} 64 | - _SpecGlossMap: 65 | m_Texture: {fileID: 0} 66 | m_Scale: {x: 1, y: 1} 67 | m_Offset: {x: 0, y: 0} 68 | - unity_Lightmaps: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - unity_LightmapsInd: 73 | m_Texture: {fileID: 0} 74 | m_Scale: {x: 1, y: 1} 75 | m_Offset: {x: 0, y: 0} 76 | - unity_ShadowMasks: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | m_Ints: [] 81 | m_Floats: 82 | - _AlphaClip: 0 83 | - _Blend: 0 84 | - _BumpScale: 1 85 | - _Cull: 2 86 | - _Cutoff: 0.5 87 | - _DetailNormalMapScale: 1 88 | - _DstBlend: 0 89 | - _GlossMapScale: 1 90 | - _Glossiness: 0.5 91 | - _GlossinessSource: 0 92 | - _GlossyReflections: 1 93 | - _Metallic: 0 94 | - _Mode: 0 95 | - _OcclusionStrength: 1 96 | - _Parallax: 0.02 97 | - _QueueOffset: 0 98 | - _ReceiveShadows: 1 99 | - _Shininess: 0 100 | - _Smoothness: 0.5 101 | - _SmoothnessSource: 1 102 | - _SmoothnessTextureChannel: 0 103 | - _SpecSource: 0 104 | - _SpecularHighlights: 1 105 | - _SrcBlend: 1 106 | - _Surface: 0 107 | - _UVSec: 0 108 | - _ZWrite: 1 109 | m_Colors: 110 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 111 | - _Color: {r: 1, g: 1, b: 1, a: 1} 112 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 113 | - _SpecColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 114 | m_BuildTextureStacks: [] 115 | --- !u!114 &6813237253610735527 116 | MonoBehaviour: 117 | m_ObjectHideFlags: 11 118 | m_CorrespondingSourceObject: {fileID: 0} 119 | m_PrefabInstance: {fileID: 0} 120 | m_PrefabAsset: {fileID: 0} 121 | m_GameObject: {fileID: 0} 122 | m_Enabled: 1 123 | m_EditorHideFlags: 0 124 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 125 | m_Name: 126 | m_EditorClassIdentifier: 127 | version: 5 128 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/CVVTuberModel/Materials/CVVTuber_face_SRP.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: CVVTuber_face_SRP 11 | m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3} 12 | m_ValidKeywords: [] 13 | m_InvalidKeywords: [] 14 | m_LightmapFlags: 4 15 | m_EnableInstancingVariants: 0 16 | m_DoubleSidedGI: 0 17 | m_CustomRenderQueue: -1 18 | stringTagMap: 19 | RenderType: Opaque 20 | disabledShaderPasses: [] 21 | m_SavedProperties: 22 | serializedVersion: 3 23 | m_TexEnvs: 24 | - _BaseMap: 25 | m_Texture: {fileID: 2800000, guid: 79e2b22a03996c24cac7e81683c9a7d4, type: 3} 26 | m_Scale: {x: 1, y: 1} 27 | m_Offset: {x: 0, y: 0} 28 | - _BumpMap: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | - _DetailAlbedoMap: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - _DetailMask: 37 | m_Texture: {fileID: 0} 38 | m_Scale: {x: 1, y: 1} 39 | m_Offset: {x: 0, y: 0} 40 | - _DetailNormalMap: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | - _EmissionMap: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - _MainTex: 49 | m_Texture: {fileID: 2800000, guid: 79e2b22a03996c24cac7e81683c9a7d4, type: 3} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | - _MetallicGlossMap: 53 | m_Texture: {fileID: 0} 54 | m_Scale: {x: 1, y: 1} 55 | m_Offset: {x: 0, y: 0} 56 | - _OcclusionMap: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - _ParallaxMap: 61 | m_Texture: {fileID: 0} 62 | m_Scale: {x: 1, y: 1} 63 | m_Offset: {x: 0, y: 0} 64 | - _SpecGlossMap: 65 | m_Texture: {fileID: 0} 66 | m_Scale: {x: 1, y: 1} 67 | m_Offset: {x: 0, y: 0} 68 | - unity_Lightmaps: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - unity_LightmapsInd: 73 | m_Texture: {fileID: 0} 74 | m_Scale: {x: 1, y: 1} 75 | m_Offset: {x: 0, y: 0} 76 | - unity_ShadowMasks: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | m_Ints: [] 81 | m_Floats: 82 | - _AlphaClip: 0 83 | - _Blend: 0 84 | - _BumpScale: 1 85 | - _Cull: 2 86 | - _Cutoff: 0.5 87 | - _DetailNormalMapScale: 1 88 | - _DstBlend: 0 89 | - _GlossMapScale: 1 90 | - _Glossiness: 0.5 91 | - _GlossinessSource: 0 92 | - _GlossyReflections: 1 93 | - _Metallic: 0 94 | - _Mode: 0 95 | - _OcclusionStrength: 1 96 | - _Parallax: 0.02 97 | - _QueueOffset: 0 98 | - _ReceiveShadows: 1 99 | - _Shininess: 0 100 | - _Smoothness: 0.5 101 | - _SmoothnessSource: 1 102 | - _SmoothnessTextureChannel: 0 103 | - _SpecSource: 0 104 | - _SpecularHighlights: 1 105 | - _SrcBlend: 1 106 | - _Surface: 0 107 | - _UVSec: 0 108 | - _ZWrite: 1 109 | m_Colors: 110 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 111 | - _Color: {r: 1, g: 1, b: 1, a: 1} 112 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 113 | - _SpecColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 114 | m_BuildTextureStacks: [] 115 | --- !u!114 &2544246246628140697 116 | MonoBehaviour: 117 | m_ObjectHideFlags: 11 118 | m_CorrespondingSourceObject: {fileID: 0} 119 | m_PrefabInstance: {fileID: 0} 120 | m_PrefabAsset: {fileID: 0} 121 | m_GameObject: {fileID: 0} 122 | m_Enabled: 1 123 | m_EditorHideFlags: 0 124 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 125 | m_Name: 126 | m_EditorClassIdentifier: 127 | version: 5 128 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/HeadLookAtIKController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CVVTuber 4 | { 5 | public class HeadLookAtIKController : CVVTuberProcess 6 | { 7 | [Header("[Input]")] 8 | 9 | [SerializeField, InterfaceRestriction(typeof(IHeadRotationGetter))] 10 | protected CVVTuberProcess headRotationGetter; 11 | 12 | protected IHeadRotationGetter _headRotationGetterInterface = null; 13 | 14 | protected IHeadRotationGetter headRotationGetterInterface 15 | { 16 | get 17 | { 18 | if (headRotationGetter != null && _headRotationGetterInterface == null) 19 | _headRotationGetterInterface = headRotationGetter.GetComponent(); 20 | return _headRotationGetterInterface; 21 | } 22 | } 23 | 24 | [Header("[Setting]")] 25 | 26 | public Vector3 offsetAngle; 27 | 28 | public bool invertXAxis; 29 | 30 | public bool invertYAxis; 31 | 32 | public bool invertZAxis; 33 | 34 | public bool rotateXAxis; 35 | 36 | public bool rotateYAxis; 37 | 38 | public bool rotateZAxis; 39 | 40 | public bool leapAngle; 41 | 42 | [Range(0, 1)] 43 | public float leapT = 0.6f; 44 | 45 | [Header("[Target]")] 46 | 47 | public Animator target; 48 | 49 | public Transform lookAtRoot; 50 | 51 | public Transform lookAtTarget; 52 | 53 | protected Vector3 headEulerAngles; 54 | 55 | protected Vector3 oldHeadEulerAngle; 56 | 57 | 58 | #region CVVTuberProcess 59 | 60 | public override string GetDescription() 61 | { 62 | return "Update head LookAt IK using HeadRotationGetter."; 63 | } 64 | 65 | public override void Setup() 66 | { 67 | NullCheck(headRotationGetterInterface, "headRotationGetter"); 68 | 69 | if (target != null) 70 | { 71 | AnimatorLookAtIKController headLookAtIKController = target.gameObject.GetComponent(); 72 | 73 | if (headLookAtIKController == null) 74 | headLookAtIKController = target.gameObject.AddComponent(); 75 | 76 | if (lookAtTarget != null) 77 | { 78 | headLookAtIKController.looktAtTarget = lookAtTarget; 79 | } 80 | else 81 | { 82 | NullWarning("lookAtTarget"); 83 | } 84 | } 85 | else 86 | { 87 | NullWarning("target"); 88 | } 89 | 90 | if (lookAtRoot != null) 91 | { 92 | oldHeadEulerAngle = lookAtRoot.localEulerAngles; 93 | } 94 | else 95 | { 96 | NullWarning("lookAtRoot"); 97 | } 98 | } 99 | 100 | public override void UpdateValue() 101 | { 102 | if (target == null) 103 | return; 104 | if (headRotationGetterInterface == null) 105 | return; 106 | if (lookAtRoot == null) 107 | return; 108 | 109 | if (headRotationGetterInterface.GetHeadEulerAngles() != Vector3.zero) 110 | { 111 | headEulerAngles = headRotationGetterInterface.GetHeadEulerAngles(); 112 | 113 | headEulerAngles = new Vector3(headEulerAngles.x + offsetAngle.x, headEulerAngles.y + offsetAngle.y, headEulerAngles.z + offsetAngle.z); 114 | headEulerAngles = new Vector3(invertXAxis ? -headEulerAngles.x : headEulerAngles.x, invertYAxis ? -headEulerAngles.y : headEulerAngles.y, invertZAxis ? -headEulerAngles.z : headEulerAngles.z); 115 | headEulerAngles = Quaternion.Euler(rotateXAxis ? 90 : 0, rotateYAxis ? 90 : 0, rotateZAxis ? 90 : 0) * headEulerAngles; 116 | } 117 | 118 | if (leapAngle) 119 | { 120 | lookAtRoot.localEulerAngles = new Vector3(Mathf.LerpAngle(oldHeadEulerAngle.x, headEulerAngles.x, leapT), Mathf.LerpAngle(oldHeadEulerAngle.y, headEulerAngles.y, leapT), Mathf.LerpAngle(oldHeadEulerAngle.z, headEulerAngles.z, leapT)); 121 | } 122 | else 123 | { 124 | lookAtRoot.localEulerAngles = headEulerAngles; 125 | } 126 | 127 | oldHeadEulerAngle = lookAtRoot.localEulerAngles; 128 | } 129 | 130 | #endregion 131 | } 132 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/MultiSourceMatSourceGetter.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.CoreModule; 2 | using OpenCVForUnity.UnityIntegration.Helper.Optimization; 3 | using OpenCVForUnity.UnityIntegration.Helper.Source2Mat; 4 | using UnityEngine; 5 | 6 | namespace CVVTuber 7 | { 8 | [RequireComponent(typeof(MultiSource2MatHelper), typeof(ImageOptimizationHelper))] 9 | public class MultiSourceMatSourceGetter : CVVTuberProcess, IMatSourceGetter 10 | { 11 | protected MultiSource2MatHelper multiSource2MatHelper; 12 | 13 | protected ImageOptimizationHelper imageOptimizationHelper; 14 | 15 | protected Mat resultMat; 16 | 17 | protected Mat downScaleResultMat; 18 | 19 | protected bool didUpdateResultMat; 20 | 21 | 22 | #region CVVTuberProcess 23 | 24 | public override string GetDescription() 25 | { 26 | return "Get mat source from WebCamTexture."; 27 | } 28 | 29 | public override void Setup() 30 | { 31 | multiSource2MatHelper = gameObject.GetComponent(); 32 | imageOptimizationHelper = gameObject.GetComponent(); 33 | 34 | multiSource2MatHelper.Initialize(); 35 | 36 | didUpdateResultMat = false; 37 | } 38 | 39 | public override void UpdateValue() 40 | { 41 | if (multiSource2MatHelper == null) 42 | return; 43 | if (imageOptimizationHelper == null) 44 | return; 45 | 46 | didUpdateResultMat = false; 47 | 48 | if (multiSource2MatHelper.IsPlaying() && multiSource2MatHelper.DidUpdateThisFrame() && !imageOptimizationHelper.IsCurrentFrameSkipped()) 49 | { 50 | 51 | resultMat = multiSource2MatHelper.GetMat(); 52 | downScaleResultMat = imageOptimizationHelper.GetDownScaleMat(resultMat); 53 | 54 | didUpdateResultMat = true; 55 | } 56 | } 57 | 58 | public override void Dispose() 59 | { 60 | if (multiSource2MatHelper != null) 61 | multiSource2MatHelper.Dispose(); 62 | 63 | if (imageOptimizationHelper != null) 64 | imageOptimizationHelper.Dispose(); 65 | 66 | if (resultMat != null) 67 | { 68 | resultMat.Dispose(); 69 | resultMat = null; 70 | } 71 | } 72 | 73 | #endregion 74 | 75 | 76 | #region IMatSourceGetter 77 | 78 | public virtual Mat GetMatSource() 79 | { 80 | if (didUpdateResultMat) 81 | { 82 | return resultMat; 83 | } 84 | else 85 | { 86 | return null; 87 | } 88 | } 89 | 90 | public virtual Mat GetDownScaleMatSource() 91 | { 92 | if (didUpdateResultMat) 93 | { 94 | return downScaleResultMat; 95 | } 96 | else 97 | { 98 | return null; 99 | } 100 | } 101 | 102 | public virtual float GetDownScaleRatio() 103 | { 104 | if (imageOptimizationHelper == null) 105 | return default; 106 | 107 | return imageOptimizationHelper.DownscaleRatio; 108 | } 109 | 110 | #endregion 111 | 112 | 113 | public virtual void Play() 114 | { 115 | if (multiSource2MatHelper == null) 116 | return; 117 | 118 | multiSource2MatHelper.Play(); 119 | } 120 | 121 | public virtual void Pause() 122 | { 123 | if (multiSource2MatHelper == null) 124 | return; 125 | 126 | multiSource2MatHelper.Pause(); 127 | } 128 | 129 | public virtual void Stop() 130 | { 131 | if (multiSource2MatHelper == null) 132 | return; 133 | 134 | multiSource2MatHelper.Stop(); 135 | } 136 | 137 | public virtual void ChangeCamera() 138 | { 139 | if (multiSource2MatHelper == null) 140 | return; 141 | 142 | #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL 143 | string deviceName = multiSource2MatHelper.GetDeviceName(); 144 | int nextCameraIndex = -1; 145 | for (int cameraIndex = 0; cameraIndex < WebCamTexture.devices.Length; cameraIndex++) 146 | { 147 | if (WebCamTexture.devices[cameraIndex].name == deviceName) 148 | { 149 | nextCameraIndex = ++cameraIndex % WebCamTexture.devices.Length; 150 | break; 151 | } 152 | } 153 | if (nextCameraIndex != -1) 154 | { 155 | multiSource2MatHelper.RequestedDeviceName = nextCameraIndex.ToString(); 156 | } 157 | else 158 | { 159 | multiSource2MatHelper.RequestedIsFrontFacing = !multiSource2MatHelper.RequestedIsFrontFacing; 160 | } 161 | #else 162 | multiSource2MatHelper.RequestedIsFrontFacing = !multiSource2MatHelper.RequestedIsFrontFacing; 163 | #endif 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuberExample.cs: -------------------------------------------------------------------------------- 1 | using DlibFaceLandmarkDetector.UnityIntegration; 2 | using OpenCVForUnity.CoreModule; 3 | using OpenCVForUnity.UnityIntegration; 4 | using UnityEngine; 5 | using UnityEngine.Rendering; 6 | using UnityEngine.SceneManagement; 7 | using UnityEngine.UI; 8 | 9 | namespace CVVTuberExample 10 | { 11 | /// 12 | /// CV VTuber Example 13 | /// 14 | public class CVVTuberExample : MonoBehaviour 15 | { 16 | public Text exampleTitle; 17 | public Text versionInfo; 18 | public ScrollRect scrollRect; 19 | static float verticalNormalizedPosition = 1f; 20 | 21 | public enum DlibShapePredictorNamePreset : int 22 | { 23 | sp_human_face_68, 24 | sp_human_face_68_for_mobile, 25 | sp_human_face_17, 26 | sp_human_face_17_for_mobile 27 | } 28 | 29 | public Dropdown dlibShapePredictorNameDropdown; 30 | 31 | static DlibShapePredictorNamePreset dlibShapePredictorName = DlibShapePredictorNamePreset.sp_human_face_68; 32 | 33 | public static string dlibShapePredictorFilePath 34 | { 35 | get 36 | { 37 | return "DlibFaceLandmarkDetector/" + dlibShapePredictorName.ToString() + ".dat"; 38 | } 39 | } 40 | 41 | // Use this for initialization 42 | void Start() 43 | { 44 | exampleTitle.text = "CV VTuber Example " + Application.version; 45 | 46 | versionInfo.text = Core.NATIVE_LIBRARY_NAME + " " + OpenCVEnv.GetVersion() + " (" + Core.VERSION + ")"; 47 | versionInfo.text += " / dlibfacelandmarkdetector" + " " + DlibEnv.GetVersion(); 48 | versionInfo.text += " / UnityEditor " + Application.unityVersion; 49 | versionInfo.text += " / "; 50 | 51 | #if UNITY_EDITOR 52 | versionInfo.text += "Editor"; 53 | #elif UNITY_STANDALONE_WIN 54 | versionInfo.text += "Windows"; 55 | #elif UNITY_STANDALONE_OSX 56 | versionInfo.text += "Mac OSX"; 57 | #elif UNITY_STANDALONE_LINUX 58 | versionInfo.text += "Linux"; 59 | #elif UNITY_ANDROID 60 | versionInfo.text += "Android"; 61 | #elif UNITY_IOS 62 | versionInfo.text += "iOS"; 63 | #elif UNITY_WSA 64 | versionInfo.text += "WSA"; 65 | #elif UNITY_WEBGL 66 | versionInfo.text += "WebGL"; 67 | #endif 68 | versionInfo.text += " "; 69 | #if ENABLE_MONO 70 | versionInfo.text += "Mono"; 71 | #elif ENABLE_IL2CPP 72 | versionInfo.text += "IL2CPP"; 73 | #elif ENABLE_DOTNET 74 | versionInfo.text += ".NET"; 75 | #endif 76 | 77 | scrollRect.verticalNormalizedPosition = verticalNormalizedPosition; 78 | 79 | dlibShapePredictorNameDropdown.value = (int)dlibShapePredictorName; 80 | } 81 | 82 | // Update is called once per frame 83 | void Update() 84 | { 85 | 86 | } 87 | 88 | public void OnScrollRectValueChanged() 89 | { 90 | verticalNormalizedPosition = scrollRect.verticalNormalizedPosition; 91 | } 92 | 93 | 94 | public void OnShowOpenCVLicenseButtonClick() 95 | { 96 | SceneManager.LoadScene("ShowOpenCVLicense"); 97 | } 98 | 99 | public void OnVideoCaptureCVVTuberExampleButtonClick() 100 | { 101 | if (GraphicsSettings.defaultRenderPipeline == null) 102 | { 103 | SceneManager.LoadScene("VideoCaptureCVVTuberExample_Built-in"); 104 | } 105 | else 106 | { 107 | SceneManager.LoadScene("VideoCaptureCVVTuberExample_SRP"); 108 | } 109 | } 110 | 111 | public void OnWebCamTextureCVVTuberExampleButtonClick() 112 | { 113 | if (GraphicsSettings.defaultRenderPipeline == null) 114 | { 115 | SceneManager.LoadScene("WebCamTextureCVVTuberExample_Built-in"); 116 | } 117 | else 118 | { 119 | SceneManager.LoadScene("WebCamTextureCVVTuberExample_SRP"); 120 | } 121 | } 122 | 123 | public void OnShowUnityChanLicenseButtonClick() 124 | { 125 | SceneManager.LoadScene("ShowUnityChanLicense"); 126 | } 127 | 128 | public void OnUnityChanCVVTuberExampleButtonClick() 129 | { 130 | SceneManager.LoadScene("UnityChanCVVTuberExample"); 131 | } 132 | 133 | public void OnLive2DCubism5CVVTuberExampleButtonClick() 134 | { 135 | SceneManager.LoadScene("Live2DCubism5CVVTuberExample"); 136 | } 137 | 138 | public void OnVRM10CVVTuberExampleButtonClick() 139 | { 140 | if (GraphicsSettings.defaultRenderPipeline == null) 141 | { 142 | SceneManager.LoadScene("VRM10CVVTuberExample_Built-in"); 143 | } 144 | else 145 | { 146 | SceneManager.LoadScene("VRM10CVVTuberExample_SRP"); 147 | } 148 | } 149 | 150 | 151 | public void OnDlibShapePredictorNameDropdownValueChanged(int result) 152 | { 153 | dlibShapePredictorName = (DlibShapePredictorNamePreset)result; 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/WebCamTextureMatSourceGetter.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.CoreModule; 2 | using OpenCVForUnity.UnityIntegration.Helper.Optimization; 3 | using OpenCVForUnity.UnityIntegration.Helper.Source2Mat; 4 | using UnityEngine; 5 | 6 | namespace CVVTuber 7 | { 8 | [RequireComponent(typeof(WebCamTexture2MatHelper), typeof(ImageOptimizationHelper))] 9 | public class WebCamTextureMatSourceGetter : CVVTuberProcess, IMatSourceGetter 10 | { 11 | protected WebCamTexture2MatHelper webCamTexture2MatHelper; 12 | 13 | protected ImageOptimizationHelper imageOptimizationHelper; 14 | 15 | protected Mat resultMat; 16 | 17 | protected Mat downScaleResultMat; 18 | 19 | protected bool didUpdateResultMat; 20 | 21 | 22 | #region CVVTuberProcess 23 | 24 | public override string GetDescription() 25 | { 26 | return "Get mat source from WebCamTexture."; 27 | } 28 | 29 | public override void Setup() 30 | { 31 | webCamTexture2MatHelper = gameObject.GetComponent(); 32 | imageOptimizationHelper = gameObject.GetComponent(); 33 | 34 | webCamTexture2MatHelper.Initialize(); 35 | 36 | didUpdateResultMat = false; 37 | } 38 | 39 | public override void UpdateValue() 40 | { 41 | if (webCamTexture2MatHelper == null) 42 | return; 43 | if (imageOptimizationHelper == null) 44 | return; 45 | 46 | didUpdateResultMat = false; 47 | 48 | if (webCamTexture2MatHelper.IsPlaying() && webCamTexture2MatHelper.DidUpdateThisFrame() && !imageOptimizationHelper.IsCurrentFrameSkipped()) 49 | { 50 | 51 | resultMat = webCamTexture2MatHelper.GetMat(); 52 | downScaleResultMat = imageOptimizationHelper.GetDownScaleMat(resultMat); 53 | 54 | didUpdateResultMat = true; 55 | } 56 | } 57 | 58 | public override void Dispose() 59 | { 60 | if (webCamTexture2MatHelper != null) 61 | webCamTexture2MatHelper.Dispose(); 62 | 63 | if (imageOptimizationHelper != null) 64 | imageOptimizationHelper.Dispose(); 65 | 66 | if (resultMat != null) 67 | { 68 | resultMat.Dispose(); 69 | resultMat = null; 70 | } 71 | } 72 | 73 | #endregion 74 | 75 | 76 | #region IMatSourceGetter 77 | 78 | public virtual Mat GetMatSource() 79 | { 80 | if (didUpdateResultMat) 81 | { 82 | return resultMat; 83 | } 84 | else 85 | { 86 | return null; 87 | } 88 | } 89 | 90 | public virtual Mat GetDownScaleMatSource() 91 | { 92 | if (didUpdateResultMat) 93 | { 94 | return downScaleResultMat; 95 | } 96 | else 97 | { 98 | return null; 99 | } 100 | } 101 | 102 | public virtual float GetDownScaleRatio() 103 | { 104 | if (imageOptimizationHelper == null) 105 | return default; 106 | 107 | return imageOptimizationHelper.DownscaleRatio; 108 | } 109 | 110 | #endregion 111 | 112 | 113 | public virtual void Play() 114 | { 115 | if (webCamTexture2MatHelper == null) 116 | return; 117 | 118 | webCamTexture2MatHelper.Play(); 119 | } 120 | 121 | public virtual void Pause() 122 | { 123 | if (webCamTexture2MatHelper == null) 124 | return; 125 | 126 | webCamTexture2MatHelper.Pause(); 127 | } 128 | 129 | public virtual void Stop() 130 | { 131 | if (webCamTexture2MatHelper == null) 132 | return; 133 | 134 | webCamTexture2MatHelper.Stop(); 135 | } 136 | 137 | public virtual void ChangeCamera() 138 | { 139 | if (webCamTexture2MatHelper == null) 140 | return; 141 | 142 | #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL 143 | string deviceName = webCamTexture2MatHelper.GetDeviceName(); 144 | int nextCameraIndex = -1; 145 | for (int cameraIndex = 0; cameraIndex < WebCamTexture.devices.Length; cameraIndex++) 146 | { 147 | if (WebCamTexture.devices[cameraIndex].name == deviceName) 148 | { 149 | nextCameraIndex = ++cameraIndex % WebCamTexture.devices.Length; 150 | break; 151 | } 152 | } 153 | if (nextCameraIndex != -1) 154 | { 155 | webCamTexture2MatHelper.RequestedDeviceName = nextCameraIndex.ToString(); 156 | } 157 | else 158 | { 159 | webCamTexture2MatHelper.RequestedIsFrontFacing = !webCamTexture2MatHelper.RequestedIsFrontFacing; 160 | } 161 | #else 162 | webCamTexture2MatHelper.RequestedIsFrontFacing = !webCamTexture2MatHelper.RequestedIsFrontFacing; 163 | #endif 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Editor/CVVTuberExampleMenuItem.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEditor.Animations; 3 | using UnityEngine; 4 | 5 | namespace CVVTuber 6 | { 7 | public class CVVTuberExampleMenuItem : MonoBehaviour 8 | { 9 | [MenuItem("Tools/CVVTuberExample/Setup CVVTuberExample", false, 1)] 10 | public static void SetCVVTuberSettings() 11 | { 12 | GameObject cVVTuberModel = GameObject.Find("CVVTuberModel"); 13 | if (cVVTuberModel != null) 14 | { 15 | //Undo.RecordObject(cVVTuberModel.transform.localEulerAngles, "Change cVVTuberModel.transform.localEulerAngles"); 16 | //cVVTuberModel.transform.localEulerAngles = new Vector3 (0, 180, 0); 17 | 18 | bool allComplete = true; 19 | 20 | Animator animator = cVVTuberModel.GetComponent(); 21 | 22 | AnimatorController animCon = animator.runtimeAnimatorController as AnimatorController; 23 | if (animCon != null) 24 | { 25 | Undo.RecordObject(animCon, "Set true to layer.ikPass"); 26 | var layers = animCon.layers; 27 | bool success = false; 28 | foreach (var layer in layers) 29 | { 30 | if (layer.stateMachine.name == "Base Layer") 31 | { 32 | layer.iKPass = true; 33 | success = true; 34 | } 35 | } 36 | EditorUtility.SetDirty(animCon); 37 | 38 | if (success) 39 | { 40 | Debug.Log("Set true to layer.ikPass"); 41 | } 42 | else 43 | { 44 | Debug.LogError("success == false"); 45 | allComplete = false; 46 | } 47 | } 48 | else 49 | { 50 | Debug.LogError("animCon == null"); 51 | allComplete = false; 52 | } 53 | 54 | HeadLookAtIKController headLookAtIKController = FindObjectOfType(); 55 | if (headLookAtIKController != null) 56 | { 57 | Undo.RecordObject(headLookAtIKController, "Set animator to headLookAtIKController.target"); 58 | headLookAtIKController.target = animator; 59 | 60 | var lookAtLoot = GameObject.Find("LookAtRoot").transform; 61 | if (lookAtLoot != null) 62 | { 63 | headLookAtIKController.lookAtRoot = lookAtLoot; 64 | var lookAtTarget = lookAtLoot.transform.Find("LookAtTarget").transform; 65 | if (lookAtTarget != null) 66 | { 67 | headLookAtIKController.lookAtTarget = lookAtTarget; 68 | } 69 | } 70 | EditorUtility.SetDirty(headLookAtIKController); 71 | 72 | if (headLookAtIKController.lookAtRoot != null && headLookAtIKController.lookAtTarget != null) 73 | { 74 | Debug.Log("Set animator to headLookAtIKController.target"); 75 | } 76 | else 77 | { 78 | Debug.LogError("headLookAtIKController.lookAtRoot == null || headLookAtIKController.lookAtTarget == null"); 79 | allComplete = false; 80 | } 81 | } 82 | else 83 | { 84 | Debug.LogError("headLookAtIKController == null"); 85 | allComplete = false; 86 | } 87 | 88 | HeadRotationController headRotationController = FindObjectOfType(); 89 | Undo.RecordObject(headRotationController, "Set head.transform to headRotationController.target"); 90 | if (headRotationController != null) 91 | { 92 | headRotationController.target = cVVTuberModel.transform.Find("Character001/hips/spine/chest/upper_chest/neck/head").transform; 93 | EditorUtility.SetDirty(headRotationController); 94 | 95 | if (headRotationController.target != null) 96 | { 97 | Debug.Log("Set head.transform to headRotationController.target"); 98 | } 99 | else 100 | { 101 | Debug.LogError("headRotationController.target == null"); 102 | allComplete = false; 103 | } 104 | } 105 | else 106 | { 107 | Debug.LogError("headRotationController == null"); 108 | allComplete = false; 109 | } 110 | 111 | FaceBlendShapeController faceBlendShapeController = FindObjectOfType(); 112 | if (faceBlendShapeController != null) 113 | { 114 | Undo.RecordObject(faceBlendShapeController, "Set SkinnedMeshRenderer to faceBlendShapeController.FACE_DEF"); 115 | faceBlendShapeController.FACE_DEF = cVVTuberModel.transform.Find("FACE_DEF").GetComponent(); 116 | EditorUtility.SetDirty(faceBlendShapeController); 117 | 118 | if (faceBlendShapeController.FACE_DEF != null) 119 | { 120 | Debug.Log("Set SkinnedMeshRenderer to faceBlendShapeController.FACE_DEF"); 121 | } 122 | else 123 | { 124 | Debug.LogError("faceBlendShapeController.FACE_DEF == null"); 125 | allComplete = false; 126 | } 127 | } 128 | else 129 | { 130 | Debug.LogError("faceBlendShapeController == null"); 131 | allComplete = false; 132 | } 133 | 134 | if (allComplete) 135 | Debug.Log("CVVTuberExample setup is all complete!"); 136 | 137 | } 138 | else 139 | { 140 | Debug.LogError("There is no \"CVVTuberModel\" prefab in the scene. Please add \"CVVTuberModel\" prefab to the scene."); 141 | } 142 | } 143 | } 144 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/Core/FaceAnimationController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace CVVTuber 5 | { 6 | public abstract class FaceAnimationController : CVVTuberProcess 7 | { 8 | [Header("[Input]")] 9 | 10 | [SerializeField, InterfaceRestriction(typeof(IFaceLandmarkGetter))] 11 | protected CVVTuberProcess faceLandmarkGetter; 12 | 13 | protected IFaceLandmarkGetter _faceLandmarkGetterInterface = null; 14 | 15 | protected IFaceLandmarkGetter faceLandmarkGetterInterface 16 | { 17 | get 18 | { 19 | if (faceLandmarkGetter != null && _faceLandmarkGetterInterface == null) 20 | _faceLandmarkGetterInterface = faceLandmarkGetter.GetComponent(); 21 | return _faceLandmarkGetterInterface; 22 | } 23 | } 24 | 25 | [Header("[Setting]")] 26 | 27 | public bool enableBrow; 28 | 29 | public bool enableEye; 30 | 31 | public bool enableMouth; 32 | 33 | [Range(0, 1)] 34 | public float BrowParam = 0; 35 | 36 | [Range(0, 1)] 37 | public float EyeParam = 0; 38 | 39 | [Range(0, 1)] 40 | public float MouthOpenParam = 0; 41 | 42 | [Range(0, 1)] 43 | public float MouthSizeParam = 0; 44 | 45 | [Range(0, 1)] 46 | public float browLeapT = 0.6f; 47 | 48 | [Range(0, 1)] 49 | public float eyeLeapT = 0.6f; 50 | 51 | [Range(0, 1)] 52 | public float mouthLeapT = 0.6f; 53 | 54 | protected List oldPoints; 55 | 56 | protected float distanceOfLeftEyeHeight; 57 | 58 | protected float distanceOfRightEyeHeight; 59 | 60 | protected float distanceOfNoseHeight; 61 | 62 | protected float distanceBetweenLeftPupliAndEyebrow; 63 | 64 | protected float distanceBetweenRightPupliAndEyebrow; 65 | 66 | protected float distanceOfMouthHeight; 67 | 68 | protected float distanceOfMouthWidth; 69 | 70 | protected float distanceBetweenEyes; 71 | 72 | 73 | #region CVVTuberProcess 74 | 75 | public override void Setup() 76 | { 77 | NullCheck(faceLandmarkGetterInterface, "faceLandmarkGetter"); 78 | } 79 | 80 | public override void UpdateValue() 81 | { 82 | if (faceLandmarkGetterInterface == null) 83 | return; 84 | 85 | List points = faceLandmarkGetterInterface.GetFaceLanmarkPoints(); 86 | 87 | if (points != null) 88 | { 89 | CalculateFacePartsDistance(points); 90 | UpdateFaceAnimation(points); 91 | 92 | oldPoints = points; 93 | } 94 | else 95 | { 96 | if (oldPoints != null) 97 | { 98 | UpdateFaceAnimation(oldPoints); 99 | } 100 | } 101 | } 102 | 103 | #endregion 104 | 105 | 106 | protected virtual void CalculateFacePartsDistance(List points) 107 | { 108 | if (points.Count == 68) 109 | { 110 | distanceOfLeftEyeHeight = new Vector2((points[47].x + points[46].x) / 2 - (points[43].x + points[44].x) / 2, (points[47].y + points[46].y) / 2 - (points[43].y + points[44].y) / 2).sqrMagnitude; 111 | distanceOfRightEyeHeight = new Vector2((points[40].x + points[41].x) / 2 - (points[38].x + points[37].x) / 2, (points[40].y + points[41].y) / 2 - (points[38].y + points[37].y) / 2).sqrMagnitude; 112 | distanceOfNoseHeight = new Vector2(points[33].x - (points[39].x + points[42].x) / 2, points[33].y - (points[39].y + points[42].y) / 2).sqrMagnitude; 113 | distanceBetweenLeftPupliAndEyebrow = new Vector2(points[24].x - (points[42].x + points[45].x) / 2, points[24].y - (points[42].y + points[45].y) / 2).sqrMagnitude; 114 | distanceBetweenRightPupliAndEyebrow = new Vector2(points[19].x - (points[39].x + points[36].x) / 2, points[19].y - (points[39].y + points[36].y) / 2).sqrMagnitude; 115 | distanceOfMouthHeight = new Vector2(points[51].x - points[57].x, points[51].y - points[57].y).sqrMagnitude; 116 | distanceOfMouthWidth = new Vector2(points[48].x - points[54].x, points[48].y - points[54].y).sqrMagnitude; 117 | distanceBetweenEyes = new Vector2(points[39].x - points[42].x, points[39].y - points[42].y).sqrMagnitude; 118 | 119 | } 120 | else if (points.Count == 17) 121 | { 122 | distanceOfLeftEyeHeight = new Vector2(points[12].x - points[11].x, points[12].y - points[11].y).sqrMagnitude; 123 | distanceOfRightEyeHeight = new Vector2(points[10].x - points[9].x, points[10].y - points[9].y).sqrMagnitude; 124 | distanceOfNoseHeight = new Vector2(points[1].x - (points[3].x + points[4].x) / 2, points[1].y - (points[3].y + points[4].y) / 2).sqrMagnitude; 125 | distanceBetweenLeftPupliAndEyebrow = 0; 126 | distanceBetweenRightPupliAndEyebrow = 0; 127 | distanceOfMouthHeight = new Vector2(points[14].x - points[16].x, points[14].y - points[16].y).sqrMagnitude; 128 | distanceOfMouthWidth = new Vector2(points[13].x - points[15].x, points[13].y - points[15].y).sqrMagnitude; 129 | distanceBetweenEyes = new Vector2(points[3].x - points[4].x, points[3].y - points[4].y).sqrMagnitude; 130 | } 131 | } 132 | 133 | protected abstract void UpdateFaceAnimation(List points); 134 | 135 | protected virtual float GetLeftEyeOpenRatio(List points) 136 | { 137 | float ratio = distanceOfLeftEyeHeight / distanceOfNoseHeight; 138 | //Debug.Log ("raw LeftEyeOpen ratio: " + ratio); 139 | return Mathf.InverseLerp(0.003f, 0.009f, ratio); 140 | } 141 | 142 | protected virtual float GetRightEyeOpenRatio(List points) 143 | { 144 | float ratio = distanceOfRightEyeHeight / distanceOfNoseHeight; 145 | //Debug.Log ("raw RightEyeOpen ratio: " + ratio); 146 | return Mathf.InverseLerp(0.003f, 0.009f, ratio); 147 | } 148 | 149 | protected virtual float GetLeftEyebrowUPRatio(List points) 150 | { 151 | float ratio = distanceBetweenLeftPupliAndEyebrow / distanceOfNoseHeight; 152 | //Debug.Log ("raw LeftEyebrowUP ratio: " + ratio); 153 | return Mathf.InverseLerp(0.18f, 0.48f, ratio); 154 | } 155 | 156 | protected virtual float GetRightEyebrowUPRatio(List points) 157 | { 158 | float ratio = distanceBetweenRightPupliAndEyebrow / distanceOfNoseHeight; 159 | //Debug.Log ("raw RightEyebrowUP ratio: " + ratio); 160 | return Mathf.InverseLerp(0.18f, 0.48f, ratio); 161 | } 162 | 163 | protected virtual float GetMouthOpenYRatio(List points) 164 | { 165 | float ratio = distanceOfMouthHeight / distanceOfNoseHeight; 166 | //Debug.Log ("raw MouthOpenY ratio: " + ratio); 167 | return Mathf.InverseLerp(0.06f, 0.6f, ratio); 168 | } 169 | 170 | protected virtual float GetMouthOpenXRatio(List points) 171 | { 172 | float ratio = distanceOfMouthWidth / distanceBetweenEyes; 173 | //Debug.Log ("raw MouthOpenX ratio: " + ratio); 174 | return Mathf.InverseLerp(1.8f, 2.0f, ratio); 175 | } 176 | } 177 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/VideoCaptureMatSourceGetter.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.CoreModule; 2 | using OpenCVForUnity.ImgprocModule; 3 | using OpenCVForUnity.UnityIntegration; 4 | using OpenCVForUnity.UnityIntegration.Helper.Optimization; 5 | using OpenCVForUnity.VideoioModule; 6 | using System; 7 | using System.Collections; 8 | using UnityEngine; 9 | using VideoCapture = OpenCVForUnity.VideoioModule.VideoCapture; 10 | 11 | namespace CVVTuber 12 | { 13 | [RequireComponent(typeof(ImageOptimizationHelper))] 14 | public class VideoCaptureMatSourceGetter : CVVTuberProcess, IMatSourceGetter 15 | { 16 | [Header("[Setting]")] 17 | 18 | [Tooltip("Set the video file path, relative to the starting point of the \"StreamingAssets\" folder, or absolute path.")] 19 | public string videoFilePath = "DlibFaceLandmarkDetector/dance_mjpeg.mjpeg"; 20 | 21 | protected ImageOptimizationHelper imageOptimizationHelper; 22 | 23 | protected VideoCapture capture; 24 | 25 | protected Mat captureMat; 26 | 27 | protected Mat resultMat; 28 | 29 | protected Mat downScaleResultMat; 30 | 31 | protected bool didUpdateResultMat; 32 | 33 | protected string videoFileFullPath; 34 | 35 | protected bool shouldUpdateVideoFrame; 36 | 37 | protected bool isPausing; 38 | 39 | #if UNITY_WEBGL 40 | protected IEnumerator getFilePath_Coroutine; 41 | #endif 42 | 43 | 44 | #region CVVTuberProcess 45 | 46 | public override string GetDescription() 47 | { 48 | return "Get mat source from VideoCapture."; 49 | } 50 | 51 | public override void Setup() 52 | { 53 | Dispose(); 54 | 55 | imageOptimizationHelper = gameObject.GetComponent(); 56 | 57 | Uri uri; 58 | if (Uri.TryCreate(videoFilePath, UriKind.Absolute, out uri)) 59 | { 60 | videoFileFullPath = uri.OriginalString; 61 | Run(); 62 | } 63 | else 64 | { 65 | #if UNITY_WEBGL 66 | getFilePath_Coroutine = GetFilePath(); 67 | StartCoroutine(getFilePath_Coroutine); 68 | #else 69 | videoFileFullPath = OpenCVEnv.GetFilePath(videoFilePath); 70 | Run(); 71 | #endif 72 | } 73 | 74 | didUpdateResultMat = false; 75 | } 76 | 77 | public override void UpdateValue() 78 | { 79 | if (capture == null) 80 | return; 81 | 82 | didUpdateResultMat = false; 83 | 84 | if (shouldUpdateVideoFrame) 85 | { 86 | shouldUpdateVideoFrame = false; 87 | 88 | //Loop play 89 | if (capture.get(Videoio.CAP_PROP_POS_FRAMES) >= capture.get(Videoio.CAP_PROP_FRAME_COUNT)) 90 | capture.set(Videoio.CAP_PROP_POS_FRAMES, 0); 91 | 92 | if (capture.grab() && !imageOptimizationHelper.IsCurrentFrameSkipped()) 93 | { 94 | 95 | capture.retrieve(captureMat, 0); 96 | 97 | Imgproc.cvtColor(captureMat, resultMat, Imgproc.COLOR_BGR2RGBA); 98 | downScaleResultMat = imageOptimizationHelper.GetDownScaleMat(resultMat); 99 | 100 | didUpdateResultMat = true; 101 | } 102 | } 103 | } 104 | 105 | public override void Dispose() 106 | { 107 | StopCoroutine("WaitFrameTime"); 108 | 109 | if (imageOptimizationHelper != null) 110 | imageOptimizationHelper.Dispose(); 111 | 112 | if (capture != null) 113 | { 114 | capture.Dispose(); 115 | capture = null; 116 | } 117 | 118 | if (captureMat != null) 119 | { 120 | captureMat.Dispose(); 121 | captureMat = null; 122 | } 123 | 124 | if (resultMat != null) 125 | { 126 | resultMat.Dispose(); 127 | resultMat = null; 128 | } 129 | 130 | #if UNITY_WEBGL 131 | if (getFilePath_Coroutine != null) 132 | { 133 | StopCoroutine(getFilePath_Coroutine); 134 | ((IDisposable)getFilePath_Coroutine).Dispose(); 135 | } 136 | #endif 137 | } 138 | 139 | #endregion 140 | 141 | 142 | #if UNITY_WEBGL 143 | protected virtual IEnumerator GetFilePath() 144 | { 145 | var getFilePathAsync_Coroutine = OpenCVEnv.GetFilePathCoroutine(videoFilePath, (result) => 146 | { 147 | videoFileFullPath = result; 148 | }); 149 | yield return getFilePathAsync_Coroutine; 150 | 151 | getFilePath_Coroutine = null; 152 | 153 | Run(); 154 | } 155 | #endif 156 | 157 | protected virtual void Run() 158 | { 159 | if (string.IsNullOrEmpty(videoFileFullPath)) 160 | { 161 | Debug.LogError("video file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. "); 162 | } 163 | 164 | captureMat = new Mat(); 165 | resultMat = new Mat(); 166 | 167 | capture = new VideoCapture(); 168 | capture.open(videoFileFullPath); 169 | 170 | if (!capture.isOpened()) 171 | { 172 | Debug.LogError("capture.isOpened() false " + videoFileFullPath); 173 | } 174 | 175 | //Debug.Log("CAP_PROP_FORMAT: " + capture.get(Videoio.CAP_PROP_FORMAT)); 176 | //Debug.Log("CAP_PROP_POS_MSEC: " + capture.get(Videoio.CAP_PROP_POS_MSEC)); 177 | //Debug.Log("CAP_PROP_POS_FRAMES: " + capture.get(Videoio.CAP_PROP_POS_FRAMES)); 178 | //Debug.Log("CAP_PROP_POS_AVI_RATIO: " + capture.get(Videoio.CAP_PROP_POS_AVI_RATIO)); 179 | //Debug.Log("CAP_PROP_FRAME_COUNT: " + capture.get(Videoio.CAP_PROP_FRAME_COUNT)); 180 | //Debug.Log("CAP_PROP_FPS: " + capture.get(Videoio.CAP_PROP_FPS)); 181 | //Debug.Log("CAP_PROP_FRAME_WIDTH: " + capture.get(Videoio.CAP_PROP_FRAME_WIDTH)); 182 | //Debug.Log("CAP_PROP_FRAME_HEIGHT: " + capture.get(Videoio.CAP_PROP_FRAME_HEIGHT)); 183 | 184 | capture.grab(); 185 | capture.retrieve(captureMat, 0); 186 | capture.set(Videoio.CAP_PROP_POS_FRAMES, 0); 187 | 188 | StartCoroutine("WaitFrameTime"); 189 | } 190 | 191 | protected virtual IEnumerator WaitFrameTime() 192 | { 193 | double videoFPS = (capture.get(Videoio.CAP_PROP_FPS) <= 0) ? 10.0 : capture.get(Videoio.CAP_PROP_FPS); 194 | int frameTime_msec = (int)Math.Round(1000.0 / videoFPS); 195 | 196 | while (true) 197 | { 198 | 199 | while (isPausing) 200 | { 201 | yield return null; 202 | } 203 | 204 | shouldUpdateVideoFrame = true; 205 | 206 | yield return new WaitForSeconds(frameTime_msec / 1000f); 207 | } 208 | } 209 | 210 | 211 | #region IMatSourceGetter 212 | 213 | public virtual Mat GetMatSource() 214 | { 215 | if (didUpdateResultMat) 216 | { 217 | return resultMat; 218 | } 219 | else 220 | { 221 | return null; 222 | } 223 | } 224 | 225 | public virtual Mat GetDownScaleMatSource() 226 | { 227 | if (didUpdateResultMat) 228 | { 229 | return downScaleResultMat; 230 | } 231 | else 232 | { 233 | return null; 234 | } 235 | } 236 | 237 | public virtual float GetDownScaleRatio() 238 | { 239 | return imageOptimizationHelper.DownscaleRatio; 240 | } 241 | 242 | #endregion 243 | 244 | 245 | public virtual void Play() 246 | { 247 | isPausing = false; 248 | } 249 | 250 | public virtual void Stop() 251 | { 252 | isPausing = true; 253 | } 254 | } 255 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/CameraController/CameraTouchController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | #if ENABLE_INPUT_SYSTEM 4 | using UnityEngine.InputSystem; 5 | using UnityEngine.InputSystem.EnhancedTouch; 6 | #endif 7 | 8 | namespace CVVTuber 9 | { 10 | public class CameraTouchController : MonoBehaviour 11 | { 12 | [SerializeField, Range(0.0f, 1.0f)] 13 | protected float moveSpeed = 0.01f; 14 | 15 | [SerializeField, Range(0.0f, 1.0f)] 16 | protected float rotateSpeed = 0.3f; 17 | 18 | [SerializeField, Range(0.0f, 1.0f)] 19 | protected float zoomSpeed = 0.03f; 20 | 21 | protected Vector3 preMousePos; 22 | 23 | #if ENABLE_INPUT_SYSTEM 24 | private void OnEnable() 25 | { 26 | EnhancedTouchSupport.Enable(); 27 | } 28 | 29 | private void OnDisable() 30 | { 31 | EnhancedTouchSupport.Disable(); 32 | } 33 | #endif 34 | 35 | protected virtual void Update() 36 | { 37 | #if ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) 38 | TouchUpdate (); 39 | #else 40 | MouseUpdate(); 41 | #endif 42 | } 43 | 44 | protected virtual void TouchUpdate() 45 | { 46 | #if ENABLE_INPUT_SYSTEM 47 | // New Input System 48 | if (UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches.Count > 0) 49 | { 50 | var touches = UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches; 51 | 52 | if (EventSystem.current != null) 53 | { 54 | if (touches.Count == 1 && EventSystem.current.IsPointerOverGameObject(touches[0].finger.index)) 55 | return; 56 | if (touches.Count == 2 && (EventSystem.current.IsPointerOverGameObject(touches[0].finger.index) || EventSystem.current.IsPointerOverGameObject(touches[1].finger.index))) 57 | return; 58 | } 59 | 60 | if (touches.Count == 1) 61 | { 62 | var touch = touches[0]; 63 | if (touch.phase == UnityEngine.InputSystem.TouchPhase.Moved) 64 | { 65 | // rotate 66 | this.transform.parent.gameObject.transform.Rotate(0, touch.delta.x * rotateSpeed, 0); 67 | 68 | // move 69 | this.transform.position += new Vector3(0, -touch.delta.y * moveSpeed / 10, 0); 70 | if (this.transform.localPosition.y < -2.0f) 71 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, -2.0f, this.transform.localPosition.z); 72 | if (this.transform.localPosition.y > 2.0f) 73 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, 2.0f, this.transform.localPosition.z); 74 | } 75 | } 76 | else if (touches.Count == 2) 77 | { 78 | var t0 = touches[0]; 79 | var t1 = touches[1]; 80 | 81 | Vector2 t0Prev = t0.screenPosition - t0.delta; 82 | Vector2 t1Prev = t1.screenPosition - t1.delta; 83 | 84 | float prevDist = (t0Prev - t1Prev).magnitude; 85 | float currDist = (t0.screenPosition - t1.screenPosition).magnitude; 86 | float deltaMag = prevDist - currDist; 87 | 88 | // zoom 89 | this.transform.localPosition += new Vector3(0, 0, deltaMag * zoomSpeed / 10); 90 | 91 | if (this.transform.localPosition.z < -5.0f) 92 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, -5.0f); 93 | if (this.transform.localPosition.z > 5.0f) 94 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, 5.0f); 95 | } 96 | } 97 | #else 98 | // Old Input System 99 | if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) 100 | { 101 | if (EventSystem.current != null) 102 | { 103 | if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)) 104 | return; 105 | } 106 | 107 | if (Input.touchCount == 1) 108 | { 109 | Touch touch = Input.GetTouch(0); 110 | 111 | //rotate 112 | this.transform.parent.gameObject.transform.Rotate(0, touch.deltaPosition.x * rotateSpeed, 0); 113 | 114 | //move 115 | this.transform.position += new Vector3(0, -touch.deltaPosition.y * moveSpeed / 10, 0); 116 | if (this.transform.localPosition.y < -2.0f) 117 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, -2.0f, this.transform.localPosition.z); 118 | if (this.transform.localPosition.y > 2.0f) 119 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, 2.0f, this.transform.localPosition.z); 120 | } 121 | else if (Input.touchCount == 2) 122 | { 123 | Touch touchZero = Input.GetTouch(0); 124 | Touch touchOne = Input.GetTouch(1); 125 | 126 | Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition; 127 | Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition; 128 | 129 | float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; 130 | float touchDeltaMag = (touchZero.position - touchOne.position).magnitude; 131 | 132 | float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag; 133 | 134 | //zoom 135 | this.transform.localPosition += new Vector3(0, 0, deltaMagnitudeDiff * zoomSpeed / 10); 136 | 137 | if (this.transform.localPosition.z < -5.0f) 138 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, -5.0f); 139 | if (this.transform.localPosition.z > 5.0f) 140 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, 5.0f); 141 | } 142 | } 143 | #endif 144 | } 145 | 146 | protected virtual void MouseUpdate() 147 | { 148 | #if ENABLE_INPUT_SYSTEM 149 | // New Input System 150 | var mouse = Mouse.current; 151 | if (mouse == null) return; 152 | 153 | float scrollWheel = mouse.scroll.ReadValue().y; 154 | if (Mathf.Abs(scrollWheel) > 0.01f) 155 | MouseWheel(scrollWheel); 156 | 157 | if (mouse.leftButton.wasPressedThisFrame) 158 | preMousePos = mouse.position.ReadValue(); 159 | 160 | MouseDrag(mouse.position.ReadValue()); 161 | #else 162 | // Old Input System 163 | float scrollWheel = Input.GetAxis("Mouse ScrollWheel"); 164 | if (scrollWheel != 0.0f) 165 | MouseWheel(scrollWheel); 166 | 167 | if (Input.GetMouseButtonDown(0)) 168 | preMousePos = Input.mousePosition; 169 | 170 | MouseDrag(Input.mousePosition); 171 | #endif 172 | } 173 | 174 | protected virtual void MouseWheel(float delta) 175 | { 176 | //zoom 177 | this.transform.localPosition += new Vector3(0, 0, delta * zoomSpeed * 10); 178 | 179 | if (this.transform.localPosition.z < -5.0f) 180 | { 181 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, -5.0f); 182 | } 183 | if (this.transform.localPosition.z > 5.0f) 184 | { 185 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, 5.0f); 186 | } 187 | } 188 | 189 | protected virtual void MouseDrag(Vector3 mousePos) 190 | { 191 | 192 | Vector3 diff = mousePos - preMousePos; 193 | 194 | #if ENABLE_INPUT_SYSTEM 195 | // New Input System 196 | var mouse = Mouse.current; 197 | if (mouse != null && mouse.leftButton.isPressed) 198 | { 199 | // rotate 200 | this.transform.parent.gameObject.transform.Rotate(0, diff.x * rotateSpeed, 0); 201 | 202 | // move 203 | this.transform.position += new Vector3(0, -diff.y * moveSpeed / 10, 0); 204 | if (this.transform.localPosition.y < -2.0f) 205 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, -2.0f, this.transform.localPosition.z); 206 | if (this.transform.localPosition.y > 2.0f) 207 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, 2.0f, this.transform.localPosition.z); 208 | } 209 | #else 210 | // Old Input System 211 | if (Input.GetMouseButton(0)) 212 | { 213 | // rotate 214 | this.transform.parent.gameObject.transform.Rotate(0, diff.x * rotateSpeed, 0); 215 | 216 | // move 217 | this.transform.position += new Vector3(0, -diff.y * moveSpeed / 10, 0); 218 | if (this.transform.localPosition.y < -2.0f) 219 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, -2.0f, this.transform.localPosition.z); 220 | if (this.transform.localPosition.y > 2.0f) 221 | this.transform.localPosition = new Vector3(this.transform.localPosition.x, 2.0f, this.transform.localPosition.z); 222 | } 223 | #endif 224 | 225 | preMousePos = mousePos; 226 | } 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/OpenCVFaceRectGetter.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.CoreModule; 2 | using OpenCVForUnity.ImgprocModule; 3 | using OpenCVForUnity.ObjdetectModule; 4 | using OpenCVForUnity.UnityIntegration; 5 | using System; 6 | using System.Collections; 7 | using UnityEngine; 8 | using UnityEngine.UI; 9 | using Rect = OpenCVForUnity.CoreModule.Rect; 10 | 11 | namespace CVVTuber 12 | { 13 | public class OpenCVFaceRectGetter : CVVTuberProcess, IFaceRectGetter 14 | { 15 | [Header("[Input]")] 16 | 17 | [SerializeField, InterfaceRestriction(typeof(IMatSourceGetter))] 18 | protected CVVTuberProcess matSourceGetter; 19 | 20 | protected IMatSourceGetter _matSourceGetterInterface = null; 21 | 22 | protected IMatSourceGetter matSourceGetterInterface 23 | { 24 | get 25 | { 26 | if (matSourceGetter != null && _matSourceGetterInterface == null) 27 | _matSourceGetterInterface = matSourceGetter.GetComponent(); 28 | return _matSourceGetterInterface; 29 | } 30 | } 31 | 32 | [Header("[Setting]")] 33 | 34 | [Tooltip("Set the cascade file path, relative to the starting point of the \"StreamingAssets\" folder, or absolute path.")] 35 | public string openCVCascadeFilePath; 36 | 37 | public bool useDownScaleMat; 38 | 39 | [Header("[Debug]")] 40 | 41 | public RawImage screen; 42 | 43 | public bool isDebugMode; 44 | 45 | public bool hideImage; 46 | 47 | protected Mat debugMat; 48 | 49 | protected Texture2D debugTexture; 50 | 51 | protected Color32[] debugColors; 52 | 53 | protected UnityEngine.Rect faceRect; 54 | 55 | protected bool didUpdateFaceRect; 56 | 57 | protected Mat grayMat; 58 | 59 | protected CascadeClassifier cascade; 60 | 61 | protected MatOfRect faces; 62 | 63 | protected static readonly string OPENCV_CASCADE_FILEPATH_PRESET = "DlibFaceLandmarkDetector/haarcascade_frontalface_alt.xml"; 64 | 65 | protected string openCVCascadeFileFullPath; 66 | 67 | #if UNITY_WEBGL 68 | protected IEnumerator getFilePath_Coroutine; 69 | #endif 70 | 71 | 72 | #region CVVTuberProcess 73 | 74 | public override string GetDescription() 75 | { 76 | return "Get face rect from MatSourceGetter."; 77 | } 78 | 79 | public override void Setup() 80 | { 81 | Dispose(); 82 | 83 | NullCheck(matSourceGetterInterface, "matSourceGetter"); 84 | 85 | if (string.IsNullOrEmpty(openCVCascadeFilePath)) 86 | openCVCascadeFilePath = OPENCV_CASCADE_FILEPATH_PRESET; 87 | 88 | Uri uri; 89 | if (Uri.TryCreate(openCVCascadeFilePath, UriKind.Absolute, out uri)) 90 | { 91 | openCVCascadeFileFullPath = uri.OriginalString; 92 | Run(); 93 | } 94 | else 95 | { 96 | #if UNITY_WEBGL 97 | getFilePath_Coroutine = OpenCVEnv.GetFilePathCoroutine(openCVCascadeFilePath, (result) => 98 | { 99 | getFilePath_Coroutine = null; 100 | 101 | openCVCascadeFileFullPath = result; 102 | Run(); 103 | }); 104 | StartCoroutine(getFilePath_Coroutine); 105 | #else 106 | openCVCascadeFileFullPath = OpenCVEnv.GetFilePath(openCVCascadeFilePath); 107 | Run(); 108 | #endif 109 | } 110 | } 111 | 112 | public override void UpdateValue() 113 | { 114 | if (cascade == null) 115 | return; 116 | 117 | if (matSourceGetterInterface == null) 118 | return; 119 | 120 | didUpdateFaceRect = false; 121 | 122 | Mat rgbaMat = (useDownScaleMat) ? matSourceGetterInterface.GetDownScaleMatSource() : matSourceGetterInterface.GetMatSource(); 123 | if (rgbaMat != null) 124 | { 125 | if (isDebugMode && screen != null) 126 | { 127 | 128 | if (debugMat != null && (debugMat.width() != rgbaMat.width() || debugMat.height() != rgbaMat.height())) 129 | { 130 | debugMat.Dispose(); 131 | debugMat = null; 132 | } 133 | debugMat = debugMat ?? new Mat(rgbaMat.rows(), rgbaMat.cols(), rgbaMat.type()); 134 | 135 | if (hideImage) 136 | { 137 | debugMat.setTo(new Scalar(0, 0, 0, 255)); 138 | } 139 | else 140 | { 141 | rgbaMat.copyTo(debugMat); 142 | } 143 | 144 | if (debugTexture != null && (debugTexture.width != debugMat.width() || debugTexture.height != debugMat.height())) 145 | { 146 | Texture2D.Destroy(debugTexture); 147 | debugTexture = null; 148 | } 149 | if (debugTexture == null) 150 | { 151 | debugTexture = new Texture2D(debugMat.width(), debugMat.height(), TextureFormat.RGBA32, false, false); 152 | 153 | Vector2 size = screen.rectTransform.sizeDelta; 154 | screen.rectTransform.sizeDelta = new Vector2(size.x, size.x * (float)debugMat.height() / (float)debugMat.width()); 155 | } 156 | 157 | if (debugColors != null && debugColors.Length != debugMat.width() * debugMat.height()) 158 | { 159 | debugColors = new Color32[debugMat.width() * debugMat.height()]; 160 | } 161 | screen.texture = debugTexture; 162 | screen.enabled = true; 163 | } 164 | else 165 | { 166 | if (screen != null) 167 | screen.enabled = false; 168 | } 169 | 170 | 171 | Imgproc.cvtColor(rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY); 172 | Imgproc.equalizeHist(grayMat, grayMat); 173 | 174 | 175 | if (cascade != null) 176 | cascade.detectMultiScale(grayMat, faces, 1.1, 2, 2, // TODO: objdetect.CV_HAAR_SCALE_IMAGE 177 | new Size(grayMat.cols() * 0.2, grayMat.rows() * 0.2), new Size()); 178 | 179 | 180 | Rect[] rects = faces.toArray(); 181 | for (int i = 0; i < rects.Length; i++) 182 | { 183 | if (i == 0) 184 | { 185 | 186 | Rect r = rects[i]; 187 | if (useDownScaleMat) 188 | { 189 | // restore to original size rect 190 | float downscaleRatio = matSourceGetterInterface.GetDownScaleRatio(); 191 | faceRect = new UnityEngine.Rect( 192 | r.x * downscaleRatio, 193 | r.y * downscaleRatio, 194 | r.width * downscaleRatio, 195 | r.height * downscaleRatio 196 | ); 197 | } 198 | else 199 | { 200 | faceRect = new UnityEngine.Rect(r.x, r.y, r.width, r.height); 201 | } 202 | 203 | didUpdateFaceRect = true; 204 | 205 | //Debug.Log ("detect faces " + rects [i]); 206 | 207 | if (isDebugMode && screen != null) 208 | Imgproc.rectangle(debugMat, new Point(r.x, r.y), new Point(r.x + r.width, r.y + r.height), new Scalar(255, 0, 0, 255), 2); 209 | } 210 | } 211 | 212 | //Imgproc.putText (debugMat, "W:" + debugMat.width () + " H:" + debugMat.height () + " SO:" + Screen.orientation, new Point (5, debugMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false); 213 | 214 | if (isDebugMode && screen != null) 215 | { 216 | OpenCVMatUtils.MatToTexture2D(debugMat, debugTexture, debugColors); 217 | } 218 | } 219 | } 220 | 221 | public override void Dispose() 222 | { 223 | if (cascade != null) 224 | { 225 | cascade.Dispose(); 226 | cascade = null; 227 | } 228 | 229 | if (grayMat != null) 230 | { 231 | grayMat.Dispose(); 232 | grayMat = null; 233 | } 234 | 235 | if (faces != null) 236 | faces.Dispose(); 237 | 238 | if (debugMat != null) 239 | { 240 | debugMat.Dispose(); 241 | debugMat = null; 242 | } 243 | 244 | if (debugTexture != null) 245 | { 246 | Texture2D.Destroy(debugTexture); 247 | debugTexture = null; 248 | } 249 | 250 | #if UNITY_WEBGL 251 | if (getFilePath_Coroutine != null) 252 | { 253 | StopCoroutine(getFilePath_Coroutine); 254 | ((IDisposable)getFilePath_Coroutine).Dispose(); 255 | } 256 | #endif 257 | } 258 | 259 | #endregion 260 | 261 | 262 | protected virtual void Run() 263 | { 264 | if (string.IsNullOrEmpty(openCVCascadeFileFullPath)) 265 | { 266 | Debug.LogError("cascade file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. "); 267 | } 268 | 269 | cascade = new CascadeClassifier(); 270 | cascade.load(openCVCascadeFileFullPath); 271 | #if !UNITY_WSA_10_0 272 | if (cascade.empty()) 273 | { 274 | Debug.LogError("cascade file is not loaded. " + openCVCascadeFileFullPath); 275 | } 276 | #endif 277 | 278 | grayMat = new Mat(); 279 | faces = new MatOfRect(); 280 | 281 | didUpdateFaceRect = false; 282 | } 283 | 284 | 285 | #region IFaceRectGetter 286 | 287 | public virtual UnityEngine.Rect GetFaceRect() 288 | { 289 | if (didUpdateFaceRect) 290 | { 291 | return faceRect; 292 | } 293 | else 294 | { 295 | return UnityEngine.Rect.zero; 296 | } 297 | } 298 | 299 | #endregion 300 | } 301 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/DlibFaceLandmarkGetter.cs: -------------------------------------------------------------------------------- 1 | using DlibFaceLandmarkDetector; 2 | using DlibFaceLandmarkDetector.UnityIntegration; 3 | using OpenCVForUnity.CoreModule; 4 | using OpenCVForUnity.ImgprocModule; 5 | using OpenCVForUnity.UnityIntegration; 6 | using System; 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | namespace CVVTuber 13 | { 14 | public class DlibFaceLandmarkGetter : CVVTuberProcess, IFaceLandmarkGetter 15 | { 16 | [Header("[Input]")] 17 | 18 | [SerializeField, InterfaceRestriction(typeof(IMatSourceGetter))] 19 | protected CVVTuberProcess matSourceGetter; 20 | 21 | protected IMatSourceGetter _matSourceGetterInterface = null; 22 | 23 | protected IMatSourceGetter matSourceGetterInterface 24 | { 25 | get 26 | { 27 | if (matSourceGetter != null && _matSourceGetterInterface == null) 28 | _matSourceGetterInterface = matSourceGetter.GetComponent(); 29 | return _matSourceGetterInterface; 30 | } 31 | } 32 | 33 | [SerializeField, InterfaceRestriction(typeof(IFaceRectGetter))] 34 | protected CVVTuberProcess faceRectGetter; 35 | 36 | protected IFaceRectGetter _faceRectGetterInterface = null; 37 | 38 | protected IFaceRectGetter faceRectGetterInterface 39 | { 40 | get 41 | { 42 | if (faceRectGetter != null && _faceRectGetterInterface == null) 43 | _faceRectGetterInterface = faceRectGetter.GetComponent(); 44 | return _faceRectGetterInterface; 45 | } 46 | } 47 | 48 | [Header("[Setting]")] 49 | 50 | [Tooltip("Set the shape predictor file path, relative to the starting point of the \"StreamingAssets\" folder, or absolute path.")] 51 | public string dlibShapePredictorFilePath; 52 | 53 | [Tooltip("Set the shape predictor mobile file path, relative to the starting point of the \"StreamingAssets\" folder, or absolute path.")] 54 | public string dlibShapePredictorMobileFilePath; 55 | 56 | [Header("[Debug]")] 57 | 58 | public RawImage screen; 59 | 60 | public bool isDebugMode; 61 | 62 | public bool hideImage; 63 | 64 | protected Mat debugMat; 65 | 66 | protected Texture2D debugTexture; 67 | 68 | protected Color32[] debugColors; 69 | 70 | protected List faceLandmarkPoints; 71 | 72 | protected bool didUpdateFaceLanmarkPoints; 73 | 74 | protected FaceLandmarkDetector faceLandmarkDetector; 75 | 76 | protected static readonly string DLIB_SHAPEPREDICTOR_FILEPATH_PRESET = "DlibFaceLandmarkDetector/sp_human_face_68.dat"; 77 | 78 | protected static readonly string DLIB_SHAPEPREDICTOR_MOBILE_FILEPATH_PRESET = "DlibFaceLandmarkDetector/sp_human_face_68_for_mobile.dat"; 79 | 80 | protected string dlibShapePredictorFileFullPath; 81 | 82 | #if UNITY_WEBGL 83 | protected IEnumerator getFilePath_Coroutine; 84 | #endif 85 | 86 | 87 | #region CVVTuberProcess 88 | 89 | public override string GetDescription() 90 | { 91 | return "Get face landmark points from MatSourceGetter."; 92 | } 93 | 94 | public override void Setup() 95 | { 96 | Dispose(); 97 | 98 | NullCheck(matSourceGetterInterface, "matSourceGetter"); 99 | 100 | if (string.IsNullOrEmpty(dlibShapePredictorFilePath)) 101 | dlibShapePredictorFilePath = DLIB_SHAPEPREDICTOR_FILEPATH_PRESET; 102 | 103 | if (string.IsNullOrEmpty(dlibShapePredictorMobileFilePath)) 104 | dlibShapePredictorMobileFilePath = DLIB_SHAPEPREDICTOR_MOBILE_FILEPATH_PRESET; 105 | 106 | 107 | #if UNITY_WEBGL 108 | Uri uri; 109 | if (Uri.TryCreate(dlibShapePredictorMobileFilePath, UriKind.Absolute, out uri)) 110 | { 111 | dlibShapePredictorFileFullPath = uri.OriginalString; 112 | Run(); 113 | } 114 | else 115 | { 116 | getFilePath_Coroutine = OpenCVEnv.GetFilePathCoroutine(dlibShapePredictorMobileFilePath, (result) => 117 | { 118 | getFilePath_Coroutine = null; 119 | 120 | dlibShapePredictorFileFullPath = result; 121 | Run(); 122 | }); 123 | StartCoroutine(getFilePath_Coroutine); 124 | } 125 | #else 126 | 127 | #if UNITY_ANDROID || UNITY_IOS 128 | Uri uri; 129 | if (Uri.TryCreate(dlibShapePredictorMobileFilePath, UriKind.Absolute, out uri)) 130 | { 131 | dlibShapePredictorFileFullPath = uri.OriginalString; 132 | } 133 | else 134 | { 135 | dlibShapePredictorFileFullPath = OpenCVEnv.GetFilePath(dlibShapePredictorMobileFilePath); 136 | } 137 | #else 138 | Uri uri; 139 | if (Uri.TryCreate(dlibShapePredictorFilePath, UriKind.Absolute, out uri)) 140 | { 141 | dlibShapePredictorFileFullPath = uri.OriginalString; 142 | } 143 | else 144 | { 145 | dlibShapePredictorFileFullPath = OpenCVEnv.GetFilePath(dlibShapePredictorFilePath); 146 | } 147 | #endif 148 | 149 | Run(); 150 | #endif 151 | } 152 | 153 | public override void UpdateValue() 154 | { 155 | if (faceLandmarkDetector == null) 156 | return; 157 | 158 | if (matSourceGetterInterface == null) 159 | return; 160 | 161 | didUpdateFaceLanmarkPoints = false; 162 | 163 | Mat rgbaMat = matSourceGetterInterface.GetMatSource(); 164 | Mat downScaleRgbaMat = matSourceGetterInterface.GetDownScaleMatSource(); 165 | if (rgbaMat != null) 166 | { 167 | if (isDebugMode && screen != null) 168 | { 169 | 170 | if (debugMat != null && (debugMat.width() != rgbaMat.width() || debugMat.height() != rgbaMat.height())) 171 | { 172 | debugMat.Dispose(); 173 | debugMat = null; 174 | } 175 | debugMat = debugMat ?? new Mat(rgbaMat.rows(), rgbaMat.cols(), rgbaMat.type()); 176 | 177 | if (hideImage) 178 | { 179 | debugMat.setTo(new Scalar(0, 0, 0, 255)); 180 | } 181 | else 182 | { 183 | rgbaMat.copyTo(debugMat); 184 | } 185 | 186 | if (debugTexture != null && (debugTexture.width != debugMat.width() || debugTexture.height != debugMat.height())) 187 | { 188 | Texture2D.Destroy(debugTexture); 189 | debugTexture = null; 190 | } 191 | if (debugTexture == null) 192 | { 193 | debugTexture = new Texture2D(debugMat.width(), debugMat.height(), TextureFormat.RGBA32, false, false); 194 | 195 | Vector2 size = screen.rectTransform.sizeDelta; 196 | screen.rectTransform.sizeDelta = new Vector2(size.x, size.x * (float)debugMat.height() / (float)debugMat.width()); 197 | } 198 | 199 | if (debugColors != null && debugColors.Length != debugMat.width() * debugMat.height()) 200 | { 201 | debugColors = new Color32[debugMat.width() * debugMat.height()]; 202 | } 203 | screen.texture = debugTexture; 204 | screen.enabled = true; 205 | } 206 | else 207 | { 208 | if (screen != null) 209 | screen.enabled = false; 210 | } 211 | 212 | 213 | if (faceRectGetterInterface != null) 214 | { 215 | 216 | UnityEngine.Rect faceRect = faceRectGetterInterface.GetFaceRect(); 217 | 218 | if (faceRect != UnityEngine.Rect.zero) 219 | { 220 | // correct the deviation of the detection result of the face rectangle of OpenCV and Dlib. 221 | faceRect = new UnityEngine.Rect( 222 | faceRect.x + (faceRect.width * 0.05f), 223 | faceRect.y + (faceRect.height * 0.1f), 224 | faceRect.width * 0.9f, 225 | faceRect.height * 0.9f); 226 | 227 | DlibOpenCVUtils.SetImage(faceLandmarkDetector, rgbaMat); 228 | List points = faceLandmarkDetector.DetectLandmark(faceRect); 229 | 230 | faceLandmarkPoints = points; 231 | 232 | didUpdateFaceLanmarkPoints = true; 233 | 234 | if (isDebugMode && screen != null) 235 | DlibOpenCVUtils.DrawFaceLandmark(debugMat, points, new Scalar(0, 255, 0, 255), 2); 236 | } 237 | } 238 | else 239 | { 240 | 241 | //detect face rects 242 | DlibOpenCVUtils.SetImage(faceLandmarkDetector, downScaleRgbaMat); 243 | List detectResult = faceLandmarkDetector.Detect(); 244 | 245 | DlibOpenCVUtils.SetImage(faceLandmarkDetector, rgbaMat); 246 | if (detectResult.Count > 0) 247 | { 248 | 249 | // restore to original size rect 250 | UnityEngine.Rect r = detectResult[0]; 251 | float downscaleRatio = matSourceGetterInterface.GetDownScaleRatio(); 252 | UnityEngine.Rect rect = new UnityEngine.Rect( 253 | r.x * downscaleRatio, 254 | r.y * downscaleRatio, 255 | r.width * downscaleRatio, 256 | r.height * downscaleRatio 257 | ); 258 | 259 | // detect landmark points 260 | List points = faceLandmarkDetector.DetectLandmark(rect); 261 | 262 | faceLandmarkPoints = points; 263 | 264 | didUpdateFaceLanmarkPoints = true; 265 | 266 | if (isDebugMode && screen != null) 267 | DlibOpenCVUtils.DrawFaceLandmark(debugMat, points, new Scalar(0, 255, 0, 255), 2); 268 | } 269 | } 270 | 271 | //Imgproc.putText (debugMat, "W:" + debugMat.width () + " H:" + debugMat.height () + " SO:" + Screen.orientation, new Point (5, debugMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false); 272 | 273 | if (isDebugMode && screen != null) 274 | { 275 | OpenCVMatUtils.MatToTexture2D(debugMat, debugTexture, debugColors); 276 | } 277 | } 278 | } 279 | 280 | public override void Dispose() 281 | { 282 | if (faceLandmarkDetector != null) 283 | { 284 | faceLandmarkDetector.Dispose(); 285 | faceLandmarkDetector = null; 286 | } 287 | 288 | if (debugMat != null) 289 | { 290 | debugMat.Dispose(); 291 | debugMat = null; 292 | } 293 | 294 | if (debugTexture != null) 295 | { 296 | Texture2D.Destroy(debugTexture); 297 | debugTexture = null; 298 | } 299 | 300 | #if UNITY_WEBGL 301 | if (getFilePath_Coroutine != null) 302 | { 303 | StopCoroutine(getFilePath_Coroutine); 304 | ((IDisposable)getFilePath_Coroutine).Dispose(); 305 | } 306 | #endif 307 | } 308 | 309 | #endregion 310 | 311 | 312 | protected virtual void Run() 313 | { 314 | if (string.IsNullOrEmpty(dlibShapePredictorFileFullPath)) 315 | { 316 | Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. "); 317 | } 318 | 319 | faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFileFullPath); 320 | 321 | didUpdateFaceLanmarkPoints = false; 322 | } 323 | 324 | 325 | #region IFaceLandmarkGetter 326 | 327 | public virtual List GetFaceLanmarkPoints() 328 | { 329 | if (didUpdateFaceLanmarkPoints) 330 | { 331 | return faceLandmarkPoints; 332 | } 333 | else 334 | { 335 | return null; 336 | } 337 | } 338 | 339 | #endregion 340 | } 341 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor/FpsMonitor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace CVVTuberExample 6 | { 7 | // v1.0.4 8 | public class FpsMonitor : MonoBehaviour 9 | { 10 | // Enums 11 | /// 12 | /// Alignment enum 13 | /// 14 | public enum Alignment 15 | { 16 | LeftTop, 17 | RightTop, 18 | LeftBottom, 19 | RightBottom, 20 | } 21 | 22 | // Constants 23 | private const float GUI_WIDTH = 95f; 24 | private const float GUI_HEIGHT = 35f; 25 | private const float MARGIN_X = 10f; 26 | private const float MARGIN_Y = 10f; 27 | private const float INNER_X = 10f; 28 | private const float INNER_Y = 10f; 29 | private const float GUI_CONSOLE_HEIGHT = 100f; 30 | private const string CANVAS_PREFAB_PATH = "FpsMonitorCanvas_104"; 31 | 32 | // Public Fields 33 | public Alignment AlignmentSetting = Alignment.RightTop; 34 | public Vector2 Offset = new Vector2(MARGIN_X, MARGIN_Y); 35 | public bool BoxVisible = true; 36 | public float BoxWidth = GUI_WIDTH; 37 | public float BoxHeight = GUI_HEIGHT; 38 | public Vector2 Padding = new Vector2(INNER_X, INNER_Y); 39 | public float ConsoleHeight = GUI_CONSOLE_HEIGHT; 40 | 41 | // Private Fields 42 | private int _tick = 0; 43 | private float _elapsed = 0; 44 | private float _fps = 0; 45 | private Text _fpsTextComponent; 46 | private Text _consoleTextComponent; 47 | private GameObject _fpsPanel; 48 | private GameObject _consolePanel; 49 | private Canvas _canvas; 50 | private Dictionary _outputDict = new Dictionary(); 51 | protected string _consoleText = null; 52 | private float _toastTime = -1; 53 | private GameObject _fpsBackgroundObj; 54 | private GameObject _consoleBackgroundObj; 55 | private bool _needsUpdate = false; 56 | private bool _isInitialized = false; 57 | private RectTransform _canvasRectTransform; 58 | private Vector2 _canvasSizeDelta; 59 | 60 | // Public Properties 61 | public virtual string ConsoleText 62 | { 63 | get { return _consoleText; } 64 | set 65 | { 66 | _consoleText = value; 67 | _toastTime = -1; 68 | UpdateConsoleText(); 69 | } 70 | } 71 | 72 | // Unity Lifecycle Methods 73 | private void Awake() 74 | { 75 | LoadCanvasFromPrefab(); 76 | LocateUI(); 77 | _isInitialized = true; 78 | _needsUpdate = true; 79 | } 80 | 81 | private void OnDestroy() 82 | { 83 | if (_canvas != null) 84 | { 85 | Destroy(_canvas.gameObject); 86 | } 87 | } 88 | 89 | private void Update() 90 | { 91 | _tick++; 92 | _elapsed += Time.deltaTime; 93 | if (_elapsed >= 1f) 94 | { 95 | _fps = _tick / _elapsed; 96 | _tick = 0; 97 | _elapsed = 0; 98 | UpdateFpsText(); 99 | } 100 | 101 | if (_toastTime > 0) 102 | { 103 | _toastTime -= Time.deltaTime * 1000; // Decrement in milliseconds 104 | if (_toastTime <= 0) 105 | { 106 | _consoleText = ""; 107 | UpdateConsoleText(); 108 | } 109 | } 110 | 111 | if (_needsUpdate) 112 | { 113 | _needsUpdate = false; 114 | UpdateUI(); 115 | } 116 | } 117 | 118 | private void OnValidate() 119 | { 120 | if (Application.isPlaying) 121 | { 122 | _needsUpdate = true; 123 | } 124 | } 125 | 126 | // Public Methods 127 | public void Add(string key, string value) 128 | { 129 | if (_outputDict.ContainsKey(key)) 130 | { 131 | _outputDict[key] = value; 132 | } 133 | else 134 | { 135 | _outputDict.Add(key, value); 136 | } 137 | UpdateFpsText(); 138 | } 139 | 140 | public void Remove(string key) 141 | { 142 | _outputDict.Remove(key); 143 | UpdateFpsText(); 144 | } 145 | 146 | public void Clear() 147 | { 148 | _outputDict.Clear(); 149 | UpdateFpsText(); 150 | } 151 | 152 | public void LocateGUI() 153 | { 154 | _needsUpdate = true; 155 | } 156 | 157 | public void Toast(string message, float timeMs = 2000f) // Default is 2 seconds 158 | { 159 | _consoleText = message; 160 | _toastTime = Mathf.Max(timeMs, 1000f); // Minimum 1 second 161 | 162 | if (!_isInitialized) 163 | { 164 | Debug.LogError("Toast: FpsMonitor is not initialized. Make sure FpsMonitor is properly set up in the scene."); 165 | return; 166 | } 167 | 168 | UpdateConsoleText(); 169 | } 170 | 171 | // Private Methods 172 | private void LoadCanvasFromPrefab() 173 | { 174 | // Load Canvas from Prefab 175 | GameObject prefab = Resources.Load(CANVAS_PREFAB_PATH); 176 | if (prefab == null) 177 | { 178 | Debug.LogError($"Failed to load FpsMonitorCanvas prefab from {CANVAS_PREFAB_PATH}"); 179 | return; 180 | } 181 | 182 | // Instantiate Canvas 183 | GameObject canvasObj = Instantiate(prefab); 184 | // Set the name to the part before the first underscore (if any) 185 | int underscoreIndex = prefab.name.IndexOf('_'); 186 | if (underscoreIndex > 0) 187 | canvasObj.name = prefab.name.Substring(0, underscoreIndex); 188 | else 189 | canvasObj.name = prefab.name; 190 | _canvas = canvasObj.GetComponent(); 191 | if (_canvas == null) 192 | { 193 | Debug.LogError("FpsMonitorCanvas prefab does not have a Canvas component"); 194 | return; 195 | } 196 | 197 | // Get references to required components 198 | _fpsPanel = canvasObj.transform.Find("FpsPanel")?.gameObject; 199 | _consolePanel = canvasObj.transform.Find("ConsolePanel")?.gameObject; 200 | 201 | if (_fpsPanel != null) 202 | { 203 | _fpsTextComponent = _fpsPanel.transform.Find("Mask/FpsText")?.GetComponent(); 204 | _fpsBackgroundObj = _fpsPanel.transform.Find("Mask/Background")?.gameObject; 205 | } 206 | 207 | if (_consolePanel != null) 208 | { 209 | _consoleTextComponent = _consolePanel.transform.Find("Mask/ConsoleText")?.GetComponent(); 210 | _consoleBackgroundObj = _consolePanel.transform.Find("Mask/Background")?.gameObject; 211 | } 212 | 213 | // Initial display settings 214 | if (_fpsPanel != null) _fpsPanel.SetActive(true); 215 | if (_consolePanel != null) _consolePanel.SetActive(false); 216 | 217 | // Show/hide background 218 | if (_fpsBackgroundObj != null) _fpsBackgroundObj.SetActive(BoxVisible); 219 | if (_consoleBackgroundObj != null) _consoleBackgroundObj.SetActive(BoxVisible); 220 | } 221 | 222 | private void LocateUI() 223 | { 224 | if (_fpsPanel == null || _consolePanel == null) return; 225 | 226 | // Set FPS panel position 227 | var fpsRect = _fpsPanel.GetComponent(); 228 | switch (AlignmentSetting) 229 | { 230 | case Alignment.LeftTop: 231 | fpsRect.anchorMin = new Vector2(0, 1); 232 | fpsRect.anchorMax = new Vector2(0, 1); 233 | fpsRect.pivot = new Vector2(0, 1); 234 | fpsRect.anchoredPosition = new Vector2(Offset.x, -Offset.y); 235 | break; 236 | case Alignment.RightTop: 237 | fpsRect.anchorMin = new Vector2(1, 1); 238 | fpsRect.anchorMax = new Vector2(1, 1); 239 | fpsRect.pivot = new Vector2(1, 1); 240 | fpsRect.anchoredPosition = new Vector2(-Offset.x, -Offset.y); 241 | break; 242 | case Alignment.LeftBottom: 243 | fpsRect.anchorMin = new Vector2(0, 0); 244 | fpsRect.anchorMax = new Vector2(0, 0); 245 | fpsRect.pivot = new Vector2(0, 0); 246 | fpsRect.anchoredPosition = new Vector2(Offset.x, Offset.y); 247 | break; 248 | case Alignment.RightBottom: 249 | fpsRect.anchorMin = new Vector2(1, 0); 250 | fpsRect.anchorMax = new Vector2(1, 0); 251 | fpsRect.pivot = new Vector2(1, 0); 252 | fpsRect.anchoredPosition = new Vector2(-Offset.x, Offset.y); 253 | break; 254 | } 255 | 256 | // Set console panel position 257 | var consoleRect = _consolePanel.GetComponent(); 258 | consoleRect.anchorMin = new Vector2(0, 0); 259 | consoleRect.anchorMax = new Vector2(1, 0); 260 | consoleRect.pivot = new Vector2(0.5f, 0); 261 | consoleRect.offsetMin = new Vector2(Offset.x, Offset.y); 262 | consoleRect.offsetMax = new Vector2(-Offset.x, Offset.y + ConsoleHeight); 263 | 264 | // Show/hide background 265 | if (_fpsBackgroundObj != null) _fpsBackgroundObj.SetActive(BoxVisible); 266 | if (_consoleBackgroundObj != null) _consoleBackgroundObj.SetActive(BoxVisible); 267 | } 268 | 269 | private void UpdateUI() 270 | { 271 | if (_fpsPanel != null) 272 | { 273 | var rectTransform = _fpsPanel.GetComponent(); 274 | rectTransform.sizeDelta = new Vector2(BoxWidth, BoxHeight); 275 | 276 | // Update FPS text padding 277 | var fpsTextTransform = _fpsTextComponent?.GetComponent(); 278 | if (fpsTextTransform != null) 279 | { 280 | fpsTextTransform.offsetMin = new Vector2(Padding.x, Padding.y); 281 | fpsTextTransform.offsetMax = new Vector2(-Padding.x, -Padding.y); 282 | } 283 | } 284 | 285 | if (_consolePanel != null) 286 | { 287 | var rectTransform = _consolePanel.GetComponent(); 288 | rectTransform.sizeDelta = new Vector2(Screen.width - Offset.x * 2, ConsoleHeight); 289 | 290 | // Update console text padding 291 | var consoleTextTransform = _consoleTextComponent?.GetComponent(); 292 | if (consoleTextTransform != null) 293 | { 294 | consoleTextTransform.offsetMin = new Vector2(Padding.x, Padding.y); 295 | consoleTextTransform.offsetMax = new Vector2(-Padding.x, -Padding.y); 296 | } 297 | } 298 | 299 | // Update show/hide background 300 | if (_fpsBackgroundObj != null) _fpsBackgroundObj.SetActive(BoxVisible); 301 | if (_consoleBackgroundObj != null) _consoleBackgroundObj.SetActive(BoxVisible); 302 | 303 | // Update panel position 304 | LocateUI(); 305 | } 306 | 307 | private void UpdateFpsText() 308 | { 309 | if (_fpsTextComponent == null) return; 310 | 311 | // Display FPS value directly 312 | string text = $"fps : {_fps:F1}"; 313 | 314 | // Add only if there is additional information 315 | if (_outputDict.Count > 0) 316 | { 317 | foreach (KeyValuePair pair in _outputDict) 318 | { 319 | text += $"\n{pair.Key} : {pair.Value}"; 320 | } 321 | } 322 | 323 | _fpsTextComponent.text = text; 324 | _fpsTextComponent.enabled = true; 325 | _fpsTextComponent.gameObject.SetActive(true); 326 | } 327 | 328 | private void UpdateConsoleText() 329 | { 330 | if (_consoleTextComponent == null || _consolePanel == null) 331 | { 332 | Debug.LogWarning("UpdateConsoleText: consoleTextComponent or consolePanel is null"); 333 | return; 334 | } 335 | 336 | if (!string.IsNullOrEmpty(_consoleText) && _toastTime != 0) 337 | { 338 | _consoleTextComponent.text = _consoleText; 339 | _consolePanel.SetActive(true); 340 | _consoleTextComponent.gameObject.SetActive(true); 341 | } 342 | else 343 | { 344 | _consoleTextComponent.text = ""; 345 | _consolePanel.SetActive(false); 346 | _consoleTextComponent.gameObject.SetActive(false); 347 | } 348 | } 349 | } 350 | } 351 | -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Scripts/FaceLandmarkHeadPositionAndRotationGetter.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.Calib3dModule; 2 | using OpenCVForUnity.CoreModule; 3 | using OpenCVForUnity.UnityIntegration; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using static OpenCVForUnity.UnityIntegration.OpenCVARUtils; 7 | 8 | namespace CVVTuber 9 | { 10 | public class FaceLandmarkHeadPositionAndRotationGetter : CVVTuberProcess, IHeadPositionGetter, IHeadRotationGetter 11 | { 12 | [Header("[Input]")] 13 | 14 | [SerializeField, InterfaceRestriction(typeof(IMatSourceGetter))] 15 | protected CVVTuberProcess matSourceGetter; 16 | 17 | protected IMatSourceGetter _matSourceGetterInterface = null; 18 | 19 | protected IMatSourceGetter matSourceGetterInterface 20 | { 21 | get 22 | { 23 | if (matSourceGetter != null && _matSourceGetterInterface == null) 24 | _matSourceGetterInterface = matSourceGetter.GetComponent(); 25 | return _matSourceGetterInterface; 26 | } 27 | } 28 | 29 | [SerializeField, InterfaceRestriction(typeof(IFaceLandmarkGetter))] 30 | protected CVVTuberProcess faceLandmarkGetter; 31 | 32 | protected IFaceLandmarkGetter _faceLandmarkGetterInterface = null; 33 | 34 | protected IFaceLandmarkGetter faceLandmarkGetterInterface 35 | { 36 | get 37 | { 38 | if (faceLandmarkGetter != null && _faceLandmarkGetterInterface == null) 39 | _faceLandmarkGetterInterface = faceLandmarkGetter.GetComponent(); 40 | return _faceLandmarkGetterInterface; 41 | } 42 | } 43 | 44 | [Header("[Setting]")] 45 | 46 | [Tooltip("Determines if enable low pass filter.")] 47 | public bool enableLowPassFilter; 48 | 49 | [Tooltip("The position low pass value. (Value in meters)")] 50 | public float positionLowPass = 2f; 51 | 52 | [Tooltip("The rotation low pass value. (Value in degrees)")] 53 | public float rotationLowPass = 1f; 54 | 55 | protected PoseData oldPoseData; 56 | 57 | protected Vector3 headPosition; 58 | 59 | protected Quaternion headRotation; 60 | 61 | protected bool didUpdateHeadPositionAndRotation; 62 | 63 | protected float imageWidth = 640; 64 | 65 | protected float imageHeight = 640; 66 | 67 | protected MatOfPoint3f objectPoints68; 68 | 69 | protected MatOfPoint3f objectPoints17; 70 | 71 | protected MatOfPoint3f objectPoints6; 72 | 73 | protected Mat camMatrix; 74 | 75 | protected MatOfDouble distCoeffs; 76 | 77 | protected MatOfPoint2f imagePoints; 78 | 79 | protected Mat rvec; 80 | 81 | protected Mat tvec; 82 | 83 | protected Matrix4x4 invertYM; 84 | 85 | protected Matrix4x4 invertZM; 86 | 87 | protected Matrix4x4 VP; 88 | 89 | 90 | #region CVVTuberProcess 91 | 92 | public override string GetDescription() 93 | { 94 | return "Get head rotation from FaceLandmarkGetter."; 95 | } 96 | 97 | public override void Setup() 98 | { 99 | NullCheck(matSourceGetterInterface, "matSourceGetter"); 100 | NullCheck(faceLandmarkGetterInterface, "faceLandmarkGetter"); 101 | 102 | //set 3d face object points. 103 | objectPoints68 = new MatOfPoint3f( 104 | new Point3(-34, 90, 83),//l eye (Interpupillary breadth) 105 | new Point3(34, 90, 83),//r eye (Interpupillary breadth) 106 | new Point3(0.0, 50, 117),//nose (Tip) 107 | new Point3(0.0, 32, 97),//nose (Subnasale) 108 | new Point3(-79, 90, 10),//l ear (Bitragion breadth) 109 | new Point3(79, 90, 10)//r ear (Bitragion breadth) 110 | ); 111 | 112 | objectPoints17 = new MatOfPoint3f( 113 | new Point3(-34, 90, 83),//l eye (Interpupillary breadth) 114 | new Point3(34, 90, 83),//r eye (Interpupillary breadth) 115 | new Point3(0.0, 50, 117),//nose (Tip) 116 | new Point3(0.0, 32, 97),//nose (Subnasale) 117 | new Point3(-79, 90, 10),//l ear (Bitragion breadth) 118 | new Point3(79, 90, 10)//r ear (Bitragion breadth) 119 | ); 120 | 121 | objectPoints6 = new MatOfPoint3f( 122 | new Point3(-34, 90, 83),//l eye (Interpupillary breadth) 123 | new Point3(34, 90, 83),//r eye (Interpupillary breadth) 124 | new Point3(0.0, 50, 117),//nose (Tip) 125 | new Point3(0.0, 32, 97)//nose (Subnasale) 126 | ); 127 | 128 | imagePoints = new MatOfPoint2f(); 129 | 130 | camMatrix = new Mat(3, 3, CvType.CV_64FC1); 131 | //Debug.Log ("camMatrix " + camMatrix.dump ()); 132 | 133 | distCoeffs = new MatOfDouble(0, 0, 0, 0); 134 | //Debug.Log ("distCoeffs " + distCoeffs.dump ()); 135 | 136 | invertYM = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, -1, 1)); 137 | //Debug.Log ("invertYM " + invertYM.ToString ()); 138 | 139 | invertZM = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, 1, -1)); 140 | //Debug.Log ("invertZM " + invertZM.ToString ()); 141 | 142 | imageWidth = imageHeight = 0; 143 | 144 | didUpdateHeadPositionAndRotation = false; 145 | } 146 | 147 | public override void UpdateValue() 148 | { 149 | if (matSourceGetterInterface == null) 150 | return; 151 | 152 | if (faceLandmarkGetterInterface == null) 153 | return; 154 | 155 | Mat rgbaMat = matSourceGetterInterface.GetMatSource(); 156 | if (rgbaMat == null) 157 | { 158 | return; 159 | } 160 | else 161 | { 162 | if (rgbaMat.width() != imageWidth || rgbaMat.height() != imageHeight) 163 | { 164 | imageWidth = rgbaMat.width(); 165 | imageHeight = rgbaMat.height(); 166 | SetCameraMatrix(camMatrix, imageWidth, imageHeight); 167 | } 168 | } 169 | 170 | didUpdateHeadPositionAndRotation = false; 171 | 172 | List points = faceLandmarkGetterInterface.GetFaceLanmarkPoints(); 173 | if (points != null) 174 | { 175 | MatOfPoint3f objectPoints = null; 176 | 177 | if (points.Count == 68) 178 | { 179 | 180 | objectPoints = objectPoints68; 181 | 182 | imagePoints.fromArray( 183 | new Point((points[38].x + points[41].x) / 2, (points[38].y + points[41].y) / 2),//l eye (Interpupillary breadth) 184 | new Point((points[43].x + points[46].x) / 2, (points[43].y + points[46].y) / 2),//r eye (Interpupillary breadth) 185 | new Point(points[30].x, points[30].y),//nose (Tip) 186 | new Point(points[33].x, points[33].y),//nose (Subnasale) 187 | new Point(points[0].x, points[0].y),//l ear (Bitragion breadth) 188 | new Point(points[16].x, points[16].y)//r ear (Bitragion breadth) 189 | ); 190 | 191 | } 192 | else if (points.Count == 17) 193 | { 194 | 195 | objectPoints = objectPoints17; 196 | 197 | imagePoints.fromArray( 198 | new Point((points[2].x + points[3].x) / 2, (points[2].y + points[3].y) / 2),//l eye (Interpupillary breadth) 199 | new Point((points[4].x + points[5].x) / 2, (points[4].y + points[5].y) / 2),//r eye (Interpupillary breadth) 200 | new Point(points[0].x, points[0].y),//nose (Tip) 201 | new Point(points[1].x, points[1].y),//nose (Subnasale) 202 | new Point(points[6].x, points[6].y),//l ear (Bitragion breadth) 203 | new Point(points[8].x, points[8].y)//r ear (Bitragion breadth) 204 | ); 205 | 206 | } 207 | else if (points.Count == 6) 208 | { 209 | 210 | objectPoints = objectPoints6; 211 | 212 | imagePoints.fromArray( 213 | new Point((points[2].x + points[3].x) / 2, (points[2].y + points[3].y) / 2),//l eye (Interpupillary breadth) 214 | new Point((points[4].x + points[5].x) / 2, (points[4].y + points[5].y) / 2),//r eye (Interpupillary breadth) 215 | new Point(points[0].x, points[0].y),//nose (Tip) 216 | new Point(points[1].x, points[1].y)//nose (Subnasale) 217 | ); 218 | } 219 | 220 | // Estimate head pose. 221 | if (rvec == null || tvec == null) 222 | { 223 | rvec = new Mat(3, 1, CvType.CV_64FC1); 224 | tvec = new Mat(3, 1, CvType.CV_64FC1); 225 | Calib3d.solvePnP(objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec); 226 | } 227 | 228 | 229 | double tvec_x = tvec.get(0, 0)[0], tvec_y = tvec.get(1, 0)[0], tvec_z = tvec.get(2, 0)[0]; 230 | 231 | bool isNotInViewport = false; 232 | Vector4 pos = VP * new Vector4((float)tvec_x, (float)tvec_y, (float)tvec_z, 1.0f); 233 | if (pos.w != 0) 234 | { 235 | float x = pos.x / pos.w, y = pos.y / pos.w, z = pos.z / pos.w; 236 | if (x < -1.0f || x > 1.0f || y < -1.0f || y > 1.0f || z < -1.0f || z > 1.0f) 237 | isNotInViewport = true; 238 | } 239 | 240 | if (double.IsNaN(tvec_z) || isNotInViewport) 241 | { // if tvec is wrong data, do not use extrinsic guesses. (the estimated object is not in the camera field of view) 242 | Calib3d.solvePnP(objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec); 243 | } 244 | else 245 | { 246 | Calib3d.solvePnP(objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec, true, Calib3d.SOLVEPNP_ITERATIVE); 247 | } 248 | 249 | //Debug.Log (tvec.dump () + " " + isNotInViewport); 250 | 251 | if (!isNotInViewport) 252 | { 253 | 254 | // Convert to unity pose data. 255 | double[] rvecArr = new double[3]; 256 | rvec.get(0, 0, rvecArr); 257 | double[] tvecArr = new double[3]; 258 | tvec.get(0, 0, tvecArr); 259 | PoseData poseData = OpenCVARUtils.ConvertRvecTvecToPoseData(rvecArr, tvecArr); 260 | 261 | // adjust the position to the scale of real-world space. 262 | poseData.Pos = new Vector3(poseData.Pos.x * 0.001f, poseData.Pos.y * 0.001f, poseData.Pos.z * 0.001f); 263 | 264 | // Changes in pos/rot below these thresholds are ignored. 265 | if (enableLowPassFilter) 266 | { 267 | OpenCVARUtils.LowpassPoseData(ref oldPoseData, ref poseData, positionLowPass, rotationLowPass); 268 | } 269 | oldPoseData = poseData; 270 | 271 | Matrix4x4 transformationM = Matrix4x4.TRS(poseData.Pos, poseData.Rot, Vector3.one); 272 | 273 | // right-handed coordinates system (OpenCV) to left-handed one (Unity) 274 | // https://stackoverflow.com/questions/30234945/change-handedness-of-a-row-major-4x4-transformation-matrix 275 | transformationM = invertYM * transformationM * invertYM; 276 | 277 | // Apply Y-axis and Z-axis refletion matrix. (Adjust the posture of the AR object) 278 | transformationM = transformationM * invertYM * invertZM; 279 | 280 | headPosition = OpenCVARUtils.ExtractTranslationFromMatrix(ref transformationM); 281 | headRotation = OpenCVARUtils.ExtractRotationFromMatrix(ref transformationM); 282 | 283 | didUpdateHeadPositionAndRotation = true; 284 | } 285 | } 286 | } 287 | 288 | public override void Dispose() 289 | { 290 | if (objectPoints68 != null) 291 | objectPoints68.Dispose(); 292 | 293 | if (camMatrix != null) 294 | camMatrix.Dispose(); 295 | if (distCoeffs != null) 296 | distCoeffs.Dispose(); 297 | 298 | if (imagePoints != null) 299 | imagePoints.Dispose(); 300 | 301 | if (rvec != null) 302 | rvec.Dispose(); 303 | 304 | if (tvec != null) 305 | tvec.Dispose(); 306 | } 307 | 308 | #endregion 309 | 310 | 311 | #region IHeadPositionGetter 312 | 313 | public virtual Vector3 GetHeadPosition() 314 | { 315 | if (didUpdateHeadPositionAndRotation) 316 | { 317 | return headPosition; 318 | } 319 | else 320 | { 321 | return Vector3.zero; 322 | } 323 | } 324 | 325 | #endregion 326 | 327 | 328 | #region IHeadRotationGetter 329 | 330 | public virtual Quaternion GetHeadRotation() 331 | { 332 | if (didUpdateHeadPositionAndRotation) 333 | { 334 | return headRotation; 335 | } 336 | else 337 | { 338 | return Quaternion.identity; 339 | } 340 | } 341 | 342 | public virtual Vector3 GetHeadEulerAngles() 343 | { 344 | if (didUpdateHeadPositionAndRotation) 345 | { 346 | 347 | 348 | return headRotation.eulerAngles; 349 | } 350 | else 351 | { 352 | return Vector3.zero; 353 | } 354 | } 355 | 356 | #endregion 357 | 358 | 359 | protected virtual void SetCameraMatrix(Mat camMatrix, float width, float height) 360 | { 361 | double max_d = (double)Mathf.Max(width, height); 362 | double fx = max_d; 363 | double fy = max_d; 364 | double cx = width / 2.0; 365 | double cy = height / 2.0; 366 | double[] arr = new double[] { fx, 0, cx, 0, fy, cy, 0, 0, 1.0 }; 367 | camMatrix.put(0, 0, arr); 368 | 369 | // create AR camera P * V Matrix 370 | Matrix4x4 P = OpenCVARUtils.CalculateProjectionMatrixFromCameraMatrixValues((float)fx, (float)fy, (float)cx, (float)cy, width, height, 1f, 3000f); 371 | Matrix4x4 V = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, 1, -1)); 372 | VP = P * V; 373 | } 374 | } 375 | } -------------------------------------------------------------------------------- /Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor/Resources/FpsMonitorCanvas_104.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &88547530971047753 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 2960041227027391153} 12 | - component: {fileID: 8374924652799457912} 13 | - component: {fileID: 9094777404771826048} 14 | m_Layer: 0 15 | m_Name: ConsoleText 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &2960041227027391153 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 88547530971047753} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_ConstrainProportionsScale: 0 32 | m_Children: [] 33 | m_Father: {fileID: 9162993602533565419} 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | m_AnchorMin: {x: 0, y: 0} 36 | m_AnchorMax: {x: 1, y: 1} 37 | m_AnchoredPosition: {x: 0, y: 0} 38 | m_SizeDelta: {x: -16, y: -10} 39 | m_Pivot: {x: 0.5, y: 0.5} 40 | --- !u!222 &8374924652799457912 41 | CanvasRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 88547530971047753} 47 | m_CullTransparentMesh: 1 48 | --- !u!114 &9094777404771826048 49 | MonoBehaviour: 50 | m_ObjectHideFlags: 0 51 | m_CorrespondingSourceObject: {fileID: 0} 52 | m_PrefabInstance: {fileID: 0} 53 | m_PrefabAsset: {fileID: 0} 54 | m_GameObject: {fileID: 88547530971047753} 55 | m_Enabled: 1 56 | m_EditorHideFlags: 0 57 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 58 | m_Name: 59 | m_EditorClassIdentifier: 60 | m_Material: {fileID: 0} 61 | m_Color: {r: 1, g: 1, b: 1, a: 1} 62 | m_RaycastTarget: 0 63 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 64 | m_Maskable: 1 65 | m_OnCullStateChanged: 66 | m_PersistentCalls: 67 | m_Calls: [] 68 | m_FontData: 69 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 70 | m_FontSize: 32 71 | m_FontStyle: 0 72 | m_BestFit: 0 73 | m_MinSize: 10 74 | m_MaxSize: 40 75 | m_Alignment: 0 76 | m_AlignByGeometry: 0 77 | m_RichText: 1 78 | m_HorizontalOverflow: 0 79 | m_VerticalOverflow: 0 80 | m_LineSpacing: 1.2 81 | m_Text: 82 | --- !u!1 &1421527245373623412 83 | GameObject: 84 | m_ObjectHideFlags: 0 85 | m_CorrespondingSourceObject: {fileID: 0} 86 | m_PrefabInstance: {fileID: 0} 87 | m_PrefabAsset: {fileID: 0} 88 | serializedVersion: 6 89 | m_Component: 90 | - component: {fileID: 5948788843511942448} 91 | - component: {fileID: 2600335492272106688} 92 | - component: {fileID: 4695352492802938031} 93 | m_Layer: 0 94 | m_Name: Background 95 | m_TagString: Untagged 96 | m_Icon: {fileID: 0} 97 | m_NavMeshLayer: 0 98 | m_StaticEditorFlags: 0 99 | m_IsActive: 1 100 | --- !u!224 &5948788843511942448 101 | RectTransform: 102 | m_ObjectHideFlags: 0 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 1421527245373623412} 107 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 108 | m_LocalPosition: {x: 0, y: 0, z: 0} 109 | m_LocalScale: {x: 1, y: 1, z: 1} 110 | m_ConstrainProportionsScale: 0 111 | m_Children: [] 112 | m_Father: {fileID: 9162993602533565419} 113 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 114 | m_AnchorMin: {x: 0, y: 0} 115 | m_AnchorMax: {x: 1, y: 1} 116 | m_AnchoredPosition: {x: 0, y: 0} 117 | m_SizeDelta: {x: 0, y: 0} 118 | m_Pivot: {x: 0.5, y: 0.5} 119 | --- !u!222 &2600335492272106688 120 | CanvasRenderer: 121 | m_ObjectHideFlags: 0 122 | m_CorrespondingSourceObject: {fileID: 0} 123 | m_PrefabInstance: {fileID: 0} 124 | m_PrefabAsset: {fileID: 0} 125 | m_GameObject: {fileID: 1421527245373623412} 126 | m_CullTransparentMesh: 1 127 | --- !u!114 &4695352492802938031 128 | MonoBehaviour: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | m_GameObject: {fileID: 1421527245373623412} 134 | m_Enabled: 1 135 | m_EditorHideFlags: 0 136 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 137 | m_Name: 138 | m_EditorClassIdentifier: 139 | m_Material: {fileID: 0} 140 | m_Color: {r: 0, g: 0, b: 0, a: 0.7} 141 | m_RaycastTarget: 1 142 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 143 | m_Maskable: 1 144 | m_OnCullStateChanged: 145 | m_PersistentCalls: 146 | m_Calls: [] 147 | m_Sprite: {fileID: 0} 148 | m_Type: 0 149 | m_PreserveAspect: 0 150 | m_FillCenter: 1 151 | m_FillMethod: 4 152 | m_FillAmount: 1 153 | m_FillClockwise: 1 154 | m_FillOrigin: 0 155 | m_UseSpriteMesh: 0 156 | m_PixelsPerUnitMultiplier: 1 157 | --- !u!1 &4317806189091502015 158 | GameObject: 159 | m_ObjectHideFlags: 0 160 | m_CorrespondingSourceObject: {fileID: 0} 161 | m_PrefabInstance: {fileID: 0} 162 | m_PrefabAsset: {fileID: 0} 163 | serializedVersion: 6 164 | m_Component: 165 | - component: {fileID: 2247695822179065220} 166 | m_Layer: 0 167 | m_Name: FpsPanel 168 | m_TagString: Untagged 169 | m_Icon: {fileID: 0} 170 | m_NavMeshLayer: 0 171 | m_StaticEditorFlags: 0 172 | m_IsActive: 1 173 | --- !u!224 &2247695822179065220 174 | RectTransform: 175 | m_ObjectHideFlags: 0 176 | m_CorrespondingSourceObject: {fileID: 0} 177 | m_PrefabInstance: {fileID: 0} 178 | m_PrefabAsset: {fileID: 0} 179 | m_GameObject: {fileID: 4317806189091502015} 180 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 181 | m_LocalPosition: {x: 0, y: 0, z: 0} 182 | m_LocalScale: {x: 1, y: 1, z: 1} 183 | m_ConstrainProportionsScale: 0 184 | m_Children: 185 | - {fileID: 1736801217961018875} 186 | m_Father: {fileID: 2634278426770862495} 187 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 188 | m_AnchorMin: {x: 1, y: 1} 189 | m_AnchorMax: {x: 1, y: 1} 190 | m_AnchoredPosition: {x: -10, y: -10} 191 | m_SizeDelta: {x: 75, y: 30} 192 | m_Pivot: {x: 1, y: 1} 193 | --- !u!1 &4533117471109683281 194 | GameObject: 195 | m_ObjectHideFlags: 0 196 | m_CorrespondingSourceObject: {fileID: 0} 197 | m_PrefabInstance: {fileID: 0} 198 | m_PrefabAsset: {fileID: 0} 199 | serializedVersion: 6 200 | m_Component: 201 | - component: {fileID: 3042919887282477287} 202 | - component: {fileID: 690126981926427942} 203 | - component: {fileID: 1845157356222043554} 204 | m_Layer: 0 205 | m_Name: FpsText 206 | m_TagString: Untagged 207 | m_Icon: {fileID: 0} 208 | m_NavMeshLayer: 0 209 | m_StaticEditorFlags: 0 210 | m_IsActive: 1 211 | --- !u!224 &3042919887282477287 212 | RectTransform: 213 | m_ObjectHideFlags: 0 214 | m_CorrespondingSourceObject: {fileID: 0} 215 | m_PrefabInstance: {fileID: 0} 216 | m_PrefabAsset: {fileID: 0} 217 | m_GameObject: {fileID: 4533117471109683281} 218 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 219 | m_LocalPosition: {x: 0, y: 0, z: 0} 220 | m_LocalScale: {x: 1, y: 1, z: 1} 221 | m_ConstrainProportionsScale: 0 222 | m_Children: [] 223 | m_Father: {fileID: 1736801217961018875} 224 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 225 | m_AnchorMin: {x: 0, y: 0} 226 | m_AnchorMax: {x: 1, y: 1} 227 | m_AnchoredPosition: {x: 0, y: 0} 228 | m_SizeDelta: {x: -16, y: -10} 229 | m_Pivot: {x: 0.5, y: 0.5} 230 | --- !u!222 &690126981926427942 231 | CanvasRenderer: 232 | m_ObjectHideFlags: 0 233 | m_CorrespondingSourceObject: {fileID: 0} 234 | m_PrefabInstance: {fileID: 0} 235 | m_PrefabAsset: {fileID: 0} 236 | m_GameObject: {fileID: 4533117471109683281} 237 | m_CullTransparentMesh: 1 238 | --- !u!114 &1845157356222043554 239 | MonoBehaviour: 240 | m_ObjectHideFlags: 0 241 | m_CorrespondingSourceObject: {fileID: 0} 242 | m_PrefabInstance: {fileID: 0} 243 | m_PrefabAsset: {fileID: 0} 244 | m_GameObject: {fileID: 4533117471109683281} 245 | m_Enabled: 1 246 | m_EditorHideFlags: 0 247 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 248 | m_Name: 249 | m_EditorClassIdentifier: 250 | m_Material: {fileID: 0} 251 | m_Color: {r: 1, g: 1, b: 1, a: 1} 252 | m_RaycastTarget: 0 253 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 254 | m_Maskable: 1 255 | m_OnCullStateChanged: 256 | m_PersistentCalls: 257 | m_Calls: [] 258 | m_FontData: 259 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 260 | m_FontSize: 14 261 | m_FontStyle: 0 262 | m_BestFit: 0 263 | m_MinSize: 1 264 | m_MaxSize: 40 265 | m_Alignment: 0 266 | m_AlignByGeometry: 0 267 | m_RichText: 1 268 | m_HorizontalOverflow: 0 269 | m_VerticalOverflow: 1 270 | m_LineSpacing: 1.4 271 | m_Text: 'fps : 420.4' 272 | --- !u!1 &5035386481926503210 273 | GameObject: 274 | m_ObjectHideFlags: 0 275 | m_CorrespondingSourceObject: {fileID: 0} 276 | m_PrefabInstance: {fileID: 0} 277 | m_PrefabAsset: {fileID: 0} 278 | serializedVersion: 6 279 | m_Component: 280 | - component: {fileID: 2634278426770862495} 281 | - component: {fileID: 7224510997022796016} 282 | - component: {fileID: 6277097474618950544} 283 | m_Layer: 0 284 | m_Name: FpsMonitorCanvas_104 285 | m_TagString: Untagged 286 | m_Icon: {fileID: 0} 287 | m_NavMeshLayer: 0 288 | m_StaticEditorFlags: 0 289 | m_IsActive: 1 290 | --- !u!224 &2634278426770862495 291 | RectTransform: 292 | m_ObjectHideFlags: 0 293 | m_CorrespondingSourceObject: {fileID: 0} 294 | m_PrefabInstance: {fileID: 0} 295 | m_PrefabAsset: {fileID: 0} 296 | m_GameObject: {fileID: 5035386481926503210} 297 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 298 | m_LocalPosition: {x: 0, y: 0, z: 0} 299 | m_LocalScale: {x: 0, y: 0, z: 0} 300 | m_ConstrainProportionsScale: 0 301 | m_Children: 302 | - {fileID: 2247695822179065220} 303 | - {fileID: 5740298816283873870} 304 | m_Father: {fileID: 0} 305 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 306 | m_AnchorMin: {x: 0, y: 0} 307 | m_AnchorMax: {x: 0, y: 0} 308 | m_AnchoredPosition: {x: 0, y: 0} 309 | m_SizeDelta: {x: 0, y: 0} 310 | m_Pivot: {x: 0, y: 0} 311 | --- !u!223 &7224510997022796016 312 | Canvas: 313 | m_ObjectHideFlags: 0 314 | m_CorrespondingSourceObject: {fileID: 0} 315 | m_PrefabInstance: {fileID: 0} 316 | m_PrefabAsset: {fileID: 0} 317 | m_GameObject: {fileID: 5035386481926503210} 318 | m_Enabled: 1 319 | serializedVersion: 3 320 | m_RenderMode: 0 321 | m_Camera: {fileID: 0} 322 | m_PlaneDistance: 100 323 | m_PixelPerfect: 0 324 | m_ReceivesEvents: 1 325 | m_OverrideSorting: 0 326 | m_OverridePixelPerfect: 0 327 | m_SortingBucketNormalizedSize: 0 328 | m_VertexColorAlwaysGammaSpace: 0 329 | m_AdditionalShaderChannelsFlag: 0 330 | m_UpdateRectTransformForStandalone: 0 331 | m_SortingLayerID: 0 332 | m_SortingOrder: 32767 333 | m_TargetDisplay: 0 334 | --- !u!114 &6277097474618950544 335 | MonoBehaviour: 336 | m_ObjectHideFlags: 0 337 | m_CorrespondingSourceObject: {fileID: 0} 338 | m_PrefabInstance: {fileID: 0} 339 | m_PrefabAsset: {fileID: 0} 340 | m_GameObject: {fileID: 5035386481926503210} 341 | m_Enabled: 1 342 | m_EditorHideFlags: 0 343 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 344 | m_Name: 345 | m_EditorClassIdentifier: 346 | m_UiScaleMode: 1 347 | m_ReferencePixelsPerUnit: 100 348 | m_ScaleFactor: 1 349 | m_ReferenceResolution: {x: 800, y: 600} 350 | m_ScreenMatchMode: 0 351 | m_MatchWidthOrHeight: 0.5 352 | m_PhysicalUnit: 3 353 | m_FallbackScreenDPI: 96 354 | m_DefaultSpriteDPI: 96 355 | m_DynamicPixelsPerUnit: 1 356 | m_PresetInfoIsWorld: 0 357 | --- !u!1 &5415138618372559246 358 | GameObject: 359 | m_ObjectHideFlags: 0 360 | m_CorrespondingSourceObject: {fileID: 0} 361 | m_PrefabInstance: {fileID: 0} 362 | m_PrefabAsset: {fileID: 0} 363 | serializedVersion: 6 364 | m_Component: 365 | - component: {fileID: 9162993602533565419} 366 | - component: {fileID: 4472520466748958470} 367 | - component: {fileID: 3697685836922098647} 368 | - component: {fileID: 4806023213221029793} 369 | m_Layer: 0 370 | m_Name: Mask 371 | m_TagString: Untagged 372 | m_Icon: {fileID: 0} 373 | m_NavMeshLayer: 0 374 | m_StaticEditorFlags: 0 375 | m_IsActive: 1 376 | --- !u!224 &9162993602533565419 377 | RectTransform: 378 | m_ObjectHideFlags: 0 379 | m_CorrespondingSourceObject: {fileID: 0} 380 | m_PrefabInstance: {fileID: 0} 381 | m_PrefabAsset: {fileID: 0} 382 | m_GameObject: {fileID: 5415138618372559246} 383 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 384 | m_LocalPosition: {x: 0, y: 0, z: 0} 385 | m_LocalScale: {x: 1, y: 1, z: 1} 386 | m_ConstrainProportionsScale: 0 387 | m_Children: 388 | - {fileID: 5948788843511942448} 389 | - {fileID: 2960041227027391153} 390 | m_Father: {fileID: 5740298816283873870} 391 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 392 | m_AnchorMin: {x: 0, y: 0} 393 | m_AnchorMax: {x: 1, y: 1} 394 | m_AnchoredPosition: {x: 0, y: 0} 395 | m_SizeDelta: {x: 0, y: 0} 396 | m_Pivot: {x: 0.5, y: 0.5} 397 | --- !u!114 &4472520466748958470 398 | MonoBehaviour: 399 | m_ObjectHideFlags: 0 400 | m_CorrespondingSourceObject: {fileID: 0} 401 | m_PrefabInstance: {fileID: 0} 402 | m_PrefabAsset: {fileID: 0} 403 | m_GameObject: {fileID: 5415138618372559246} 404 | m_Enabled: 1 405 | m_EditorHideFlags: 0 406 | m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} 407 | m_Name: 408 | m_EditorClassIdentifier: 409 | m_ShowMaskGraphic: 0 410 | --- !u!222 &3697685836922098647 411 | CanvasRenderer: 412 | m_ObjectHideFlags: 0 413 | m_CorrespondingSourceObject: {fileID: 0} 414 | m_PrefabInstance: {fileID: 0} 415 | m_PrefabAsset: {fileID: 0} 416 | m_GameObject: {fileID: 5415138618372559246} 417 | m_CullTransparentMesh: 1 418 | --- !u!114 &4806023213221029793 419 | MonoBehaviour: 420 | m_ObjectHideFlags: 0 421 | m_CorrespondingSourceObject: {fileID: 0} 422 | m_PrefabInstance: {fileID: 0} 423 | m_PrefabAsset: {fileID: 0} 424 | m_GameObject: {fileID: 5415138618372559246} 425 | m_Enabled: 1 426 | m_EditorHideFlags: 0 427 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 428 | m_Name: 429 | m_EditorClassIdentifier: 430 | m_Material: {fileID: 0} 431 | m_Color: {r: 1, g: 1, b: 1, a: 1} 432 | m_RaycastTarget: 1 433 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 434 | m_Maskable: 1 435 | m_OnCullStateChanged: 436 | m_PersistentCalls: 437 | m_Calls: [] 438 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 439 | m_Type: 1 440 | m_PreserveAspect: 0 441 | m_FillCenter: 1 442 | m_FillMethod: 4 443 | m_FillAmount: 1 444 | m_FillClockwise: 1 445 | m_FillOrigin: 0 446 | m_UseSpriteMesh: 0 447 | m_PixelsPerUnitMultiplier: 1 448 | --- !u!1 &6988854209712280463 449 | GameObject: 450 | m_ObjectHideFlags: 0 451 | m_CorrespondingSourceObject: {fileID: 0} 452 | m_PrefabInstance: {fileID: 0} 453 | m_PrefabAsset: {fileID: 0} 454 | serializedVersion: 6 455 | m_Component: 456 | - component: {fileID: 1736801217961018875} 457 | - component: {fileID: 8165586050098606129} 458 | - component: {fileID: 1265439493009184468} 459 | - component: {fileID: 6293427381752733375} 460 | m_Layer: 0 461 | m_Name: Mask 462 | m_TagString: Untagged 463 | m_Icon: {fileID: 0} 464 | m_NavMeshLayer: 0 465 | m_StaticEditorFlags: 0 466 | m_IsActive: 1 467 | --- !u!224 &1736801217961018875 468 | RectTransform: 469 | m_ObjectHideFlags: 0 470 | m_CorrespondingSourceObject: {fileID: 0} 471 | m_PrefabInstance: {fileID: 0} 472 | m_PrefabAsset: {fileID: 0} 473 | m_GameObject: {fileID: 6988854209712280463} 474 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 475 | m_LocalPosition: {x: 0, y: 0, z: 0} 476 | m_LocalScale: {x: 1, y: 1, z: 1} 477 | m_ConstrainProportionsScale: 0 478 | m_Children: 479 | - {fileID: 3624319049381362025} 480 | - {fileID: 3042919887282477287} 481 | m_Father: {fileID: 2247695822179065220} 482 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 483 | m_AnchorMin: {x: 0, y: 0} 484 | m_AnchorMax: {x: 1, y: 1} 485 | m_AnchoredPosition: {x: 0, y: 0} 486 | m_SizeDelta: {x: 0, y: 0} 487 | m_Pivot: {x: 0.5, y: 0.5} 488 | --- !u!114 &8165586050098606129 489 | MonoBehaviour: 490 | m_ObjectHideFlags: 0 491 | m_CorrespondingSourceObject: {fileID: 0} 492 | m_PrefabInstance: {fileID: 0} 493 | m_PrefabAsset: {fileID: 0} 494 | m_GameObject: {fileID: 6988854209712280463} 495 | m_Enabled: 1 496 | m_EditorHideFlags: 0 497 | m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} 498 | m_Name: 499 | m_EditorClassIdentifier: 500 | m_ShowMaskGraphic: 0 501 | --- !u!222 &1265439493009184468 502 | CanvasRenderer: 503 | m_ObjectHideFlags: 0 504 | m_CorrespondingSourceObject: {fileID: 0} 505 | m_PrefabInstance: {fileID: 0} 506 | m_PrefabAsset: {fileID: 0} 507 | m_GameObject: {fileID: 6988854209712280463} 508 | m_CullTransparentMesh: 1 509 | --- !u!114 &6293427381752733375 510 | MonoBehaviour: 511 | m_ObjectHideFlags: 0 512 | m_CorrespondingSourceObject: {fileID: 0} 513 | m_PrefabInstance: {fileID: 0} 514 | m_PrefabAsset: {fileID: 0} 515 | m_GameObject: {fileID: 6988854209712280463} 516 | m_Enabled: 1 517 | m_EditorHideFlags: 0 518 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 519 | m_Name: 520 | m_EditorClassIdentifier: 521 | m_Material: {fileID: 0} 522 | m_Color: {r: 1, g: 1, b: 1, a: 1} 523 | m_RaycastTarget: 1 524 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 525 | m_Maskable: 1 526 | m_OnCullStateChanged: 527 | m_PersistentCalls: 528 | m_Calls: [] 529 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 530 | m_Type: 1 531 | m_PreserveAspect: 0 532 | m_FillCenter: 1 533 | m_FillMethod: 4 534 | m_FillAmount: 1 535 | m_FillClockwise: 1 536 | m_FillOrigin: 0 537 | m_UseSpriteMesh: 0 538 | m_PixelsPerUnitMultiplier: 1 539 | --- !u!1 &8341289413509603316 540 | GameObject: 541 | m_ObjectHideFlags: 0 542 | m_CorrespondingSourceObject: {fileID: 0} 543 | m_PrefabInstance: {fileID: 0} 544 | m_PrefabAsset: {fileID: 0} 545 | serializedVersion: 6 546 | m_Component: 547 | - component: {fileID: 5740298816283873870} 548 | m_Layer: 0 549 | m_Name: ConsolePanel 550 | m_TagString: Untagged 551 | m_Icon: {fileID: 0} 552 | m_NavMeshLayer: 0 553 | m_StaticEditorFlags: 0 554 | m_IsActive: 1 555 | --- !u!224 &5740298816283873870 556 | RectTransform: 557 | m_ObjectHideFlags: 0 558 | m_CorrespondingSourceObject: {fileID: 0} 559 | m_PrefabInstance: {fileID: 0} 560 | m_PrefabAsset: {fileID: 0} 561 | m_GameObject: {fileID: 8341289413509603316} 562 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 563 | m_LocalPosition: {x: 0, y: 0, z: 0} 564 | m_LocalScale: {x: 1, y: 1, z: 1} 565 | m_ConstrainProportionsScale: 0 566 | m_Children: 567 | - {fileID: 9162993602533565419} 568 | m_Father: {fileID: 2634278426770862495} 569 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 570 | m_AnchorMin: {x: 0, y: 0} 571 | m_AnchorMax: {x: 1, y: 0} 572 | m_AnchoredPosition: {x: 0, y: 10} 573 | m_SizeDelta: {x: -20, y: 100} 574 | m_Pivot: {x: 0.5, y: 0} 575 | --- !u!1 &8755350862857948778 576 | GameObject: 577 | m_ObjectHideFlags: 0 578 | m_CorrespondingSourceObject: {fileID: 0} 579 | m_PrefabInstance: {fileID: 0} 580 | m_PrefabAsset: {fileID: 0} 581 | serializedVersion: 6 582 | m_Component: 583 | - component: {fileID: 3624319049381362025} 584 | - component: {fileID: 6950658074372656459} 585 | - component: {fileID: 1578015334169123505} 586 | m_Layer: 0 587 | m_Name: Background 588 | m_TagString: Untagged 589 | m_Icon: {fileID: 0} 590 | m_NavMeshLayer: 0 591 | m_StaticEditorFlags: 0 592 | m_IsActive: 1 593 | --- !u!224 &3624319049381362025 594 | RectTransform: 595 | m_ObjectHideFlags: 0 596 | m_CorrespondingSourceObject: {fileID: 0} 597 | m_PrefabInstance: {fileID: 0} 598 | m_PrefabAsset: {fileID: 0} 599 | m_GameObject: {fileID: 8755350862857948778} 600 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 601 | m_LocalPosition: {x: 0, y: 0, z: 0} 602 | m_LocalScale: {x: 1, y: 1, z: 1} 603 | m_ConstrainProportionsScale: 0 604 | m_Children: [] 605 | m_Father: {fileID: 1736801217961018875} 606 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 607 | m_AnchorMin: {x: 0, y: 0} 608 | m_AnchorMax: {x: 1, y: 1} 609 | m_AnchoredPosition: {x: 0, y: 0} 610 | m_SizeDelta: {x: 0, y: 0} 611 | m_Pivot: {x: 0.5, y: 0.5} 612 | --- !u!222 &6950658074372656459 613 | CanvasRenderer: 614 | m_ObjectHideFlags: 0 615 | m_CorrespondingSourceObject: {fileID: 0} 616 | m_PrefabInstance: {fileID: 0} 617 | m_PrefabAsset: {fileID: 0} 618 | m_GameObject: {fileID: 8755350862857948778} 619 | m_CullTransparentMesh: 1 620 | --- !u!114 &1578015334169123505 621 | MonoBehaviour: 622 | m_ObjectHideFlags: 0 623 | m_CorrespondingSourceObject: {fileID: 0} 624 | m_PrefabInstance: {fileID: 0} 625 | m_PrefabAsset: {fileID: 0} 626 | m_GameObject: {fileID: 8755350862857948778} 627 | m_Enabled: 1 628 | m_EditorHideFlags: 0 629 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 630 | m_Name: 631 | m_EditorClassIdentifier: 632 | m_Material: {fileID: 0} 633 | m_Color: {r: 0, g: 0, b: 0, a: 0.7} 634 | m_RaycastTarget: 1 635 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 636 | m_Maskable: 1 637 | m_OnCullStateChanged: 638 | m_PersistentCalls: 639 | m_Calls: [] 640 | m_Sprite: {fileID: 0} 641 | m_Type: 0 642 | m_PreserveAspect: 0 643 | m_FillCenter: 1 644 | m_FillMethod: 4 645 | m_FillAmount: 1 646 | m_FillClockwise: 1 647 | m_FillOrigin: 0 648 | m_UseSpriteMesh: 0 649 | m_PixelsPerUnitMultiplier: 1 650 | --------------------------------------------------------------------------------