FIX : 소소한 버그 패치
This commit is contained in:
parent
e9e1c12284
commit
295645f0da
@ -16,22 +16,15 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
private UdpClient client;
|
private UdpClient client;
|
||||||
private bool StartFlag = true;
|
private bool StartFlag = true;
|
||||||
|
|
||||||
//object names
|
//object references
|
||||||
public string faceObjectGroupName = "";
|
public SkinnedMeshRenderer[] faceMeshRenderers;
|
||||||
public string headBoneName = "";
|
public Transform headBone;
|
||||||
public string rightEyeBoneName = "";
|
public Transform rightEyeBone;
|
||||||
public string leftEyeBoneName = "";
|
public Transform leftEyeBone;
|
||||||
public string headPositionObjectName = "";
|
public Transform headPositionObject;
|
||||||
|
|
||||||
private UdpClient udp;
|
private UdpClient udp;
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
private SkinnedMeshRenderer meshTarget;
|
|
||||||
private List<SkinnedMeshRenderer> meshTargetList;
|
|
||||||
private List<GameObject> headObjectArray;
|
|
||||||
private List<GameObject> rightEyeObjectArray;
|
|
||||||
private List<GameObject> leftEyeObjectArray;
|
|
||||||
private List<GameObject> headPositionObjectArray;
|
|
||||||
|
|
||||||
private string messageString = "";
|
private string messageString = "";
|
||||||
public int LOCAL_PORT = 49983;
|
public int LOCAL_PORT = 49983;
|
||||||
|
|
||||||
@ -62,11 +55,18 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
|
|
||||||
void CreateUdpServer()
|
void CreateUdpServer()
|
||||||
{
|
{
|
||||||
udp = new UdpClient(LOCAL_PORT);
|
try
|
||||||
udp.Client.ReceiveTimeout = 5;
|
{
|
||||||
|
udp = new UdpClient(LOCAL_PORT);
|
||||||
|
udp.Client.ReceiveTimeout = 5;
|
||||||
|
|
||||||
thread = new Thread(new ThreadStart(ThreadMethod));
|
thread = new Thread(new ThreadStart(ThreadMethod));
|
||||||
thread.Start();
|
thread.Start();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"[iFacialMocap] UDP 서버 생성 실패: {e.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator WaitProcess(float WaitTime)
|
IEnumerator WaitProcess(float WaitTime)
|
||||||
@ -76,11 +76,18 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
|
|
||||||
void Connect_to_iOS_App()
|
void Connect_to_iOS_App()
|
||||||
{
|
{
|
||||||
//iFacialMocap
|
try
|
||||||
SendMessage_to_iOSapp("iFacialMocap_sahuasouryya9218sauhuiayeta91555dy3719", 49983);
|
{
|
||||||
|
//iFacialMocap
|
||||||
|
SendMessage_to_iOSapp("iFacialMocap_sahuasouryya9218sauhuiayeta91555dy3719", 49983);
|
||||||
|
|
||||||
//Facemotion3d
|
//Facemotion3d
|
||||||
SendMessage_to_iOSapp("FACEMOTION3D_OtherStreaming", 49993);
|
SendMessage_to_iOSapp("FACEMOTION3D_OtherStreaming", 49993);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"[iFacialMocap] iOS 앱 연결 실패: {e.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopStreaming_iOS_App()
|
void StopStreaming_iOS_App()
|
||||||
@ -90,20 +97,24 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
|
|
||||||
//iOSアプリに通信開始のメッセージを送信
|
//iOSアプリに通信開始のメッセージを送信
|
||||||
//Send a message to the iOS application to start streaming
|
//Send a message to the iOS application to start streaming
|
||||||
void SendMessage_to_iOSapp(string sendMessage,int send_port)
|
void SendMessage_to_iOSapp(string sendMessage, int send_port)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
client = new UdpClient();
|
client = new UdpClient();
|
||||||
client.Connect(iOS_IPAddress, send_port);
|
client.Connect(iOS_IPAddress, send_port);
|
||||||
byte[] dgram = Encoding.UTF8.GetBytes(sendMessage);
|
byte[] dgram = Encoding.UTF8.GetBytes(sendMessage);
|
||||||
client.Send(dgram, dgram.Length);
|
|
||||||
client.Send(dgram, dgram.Length);
|
// 메시지 전송 시도
|
||||||
client.Send(dgram, dgram.Length);
|
for (int i = 0; i < 5; i++)
|
||||||
client.Send(dgram, dgram.Length);
|
{
|
||||||
client.Send(dgram, dgram.Length);
|
client.Send(dgram, dgram.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"[iFacialMocap] 메시지 전송 실패: {e.Message}");
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -122,17 +133,20 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
void SetBlendShapeWeightFromStrArray(string[] strArray2)
|
void SetBlendShapeWeightFromStrArray(string[] strArray2)
|
||||||
{
|
{
|
||||||
string mappedShapeName = strArray2[0].Replace("_R", "Right").Replace("_L", "Left");
|
string mappedShapeName = strArray2[0].Replace("_R", "Right").Replace("_L", "Left");
|
||||||
|
|
||||||
float weight = float.Parse(strArray2[1], CultureInfo.InvariantCulture);
|
float weight = float.Parse(strArray2[1], CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
if (faceMeshRenderers != null)
|
||||||
foreach (SkinnedMeshRenderer meshTarget in meshTargetList)
|
|
||||||
{
|
{
|
||||||
var shared_mesh = meshTarget.sharedMesh;
|
foreach (var meshRenderer in faceMeshRenderers)
|
||||||
int index = shared_mesh.GetBlendShapeIndex(mappedShapeName);
|
|
||||||
if (index > -1)
|
|
||||||
{
|
{
|
||||||
meshTarget.SetBlendShapeWeight(index, weight);
|
if (meshRenderer != null && meshRenderer.sharedMesh != null)
|
||||||
|
{
|
||||||
|
int index = meshRenderer.sharedMesh.GetBlendShapeIndex(mappedShapeName);
|
||||||
|
if (index > -1)
|
||||||
|
{
|
||||||
|
meshRenderer.SetBlendShapeWeight(index, weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,31 +188,22 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
if (strArray2.Length == 2)
|
if (strArray2.Length == 2)
|
||||||
{
|
{
|
||||||
string[] commaList = strArray2[1].Split(',');
|
string[] commaList = strArray2[1].Split(',');
|
||||||
if (strArray2[0] == "head")
|
if (strArray2[0] == "head" && headBone != null)
|
||||||
{
|
{
|
||||||
foreach (GameObject headObject in headObjectArray)
|
headBone.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), -float.Parse(commaList[2], CultureInfo.InvariantCulture));
|
||||||
{
|
|
||||||
headObject.transform.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), -float.Parse(commaList[2], CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (GameObject headPositionObject in headPositionObjectArray)
|
if (headPositionObject != null)
|
||||||
{
|
{
|
||||||
headPositionObject.transform.localPosition = new Vector3(-float.Parse(commaList[3], CultureInfo.InvariantCulture), float.Parse(commaList[4], CultureInfo.InvariantCulture), float.Parse(commaList[5], CultureInfo.InvariantCulture));
|
headPositionObject.localPosition = new Vector3(-float.Parse(commaList[3], CultureInfo.InvariantCulture), float.Parse(commaList[4], CultureInfo.InvariantCulture), float.Parse(commaList[5], CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strArray2[0] == "rightEye")
|
else if (strArray2[0] == "rightEye" && rightEyeBone != null)
|
||||||
{
|
{
|
||||||
foreach (GameObject rightEyeObject in rightEyeObjectArray)
|
rightEyeBone.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), float.Parse(commaList[2], CultureInfo.InvariantCulture));
|
||||||
{
|
|
||||||
rightEyeObject.transform.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), float.Parse(commaList[2], CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (strArray2[0] == "leftEye")
|
else if (strArray2[0] == "leftEye" && leftEyeBone != null)
|
||||||
{
|
{
|
||||||
foreach (GameObject leftEyeObject in leftEyeObjectArray)
|
leftEyeBone.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), float.Parse(commaList[2], CultureInfo.InvariantCulture));
|
||||||
{
|
|
||||||
leftEyeObject.transform.localRotation = Quaternion.Euler(float.Parse(commaList[0], CultureInfo.InvariantCulture), -float.Parse(commaList[1], CultureInfo.InvariantCulture), float.Parse(commaList[2], CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,68 +216,7 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
|
|
||||||
void FindGameObjectsInsideUnitySettings()
|
void FindGameObjectsInsideUnitySettings()
|
||||||
{
|
{
|
||||||
//Find BlendShape Objects
|
// 모든 Transform 참조는 이미 인스펙터에서 할당되므로 추가 초기화가 필요 없음
|
||||||
meshTargetList = new List<SkinnedMeshRenderer>();
|
|
||||||
|
|
||||||
GameObject faceObjGrp = GameObject.Find(faceObjectGroupName);
|
|
||||||
if (faceObjGrp != null)
|
|
||||||
{
|
|
||||||
List<GameObject> list = FM3D_and_iFacialMocap_GetAllChildren.GetAll(faceObjGrp);
|
|
||||||
|
|
||||||
foreach (GameObject obj in list)
|
|
||||||
{
|
|
||||||
meshTarget = obj.GetComponent<SkinnedMeshRenderer>();
|
|
||||||
if (meshTarget != null)
|
|
||||||
{
|
|
||||||
if (HasBlendShapes(meshTarget) == true)
|
|
||||||
{
|
|
||||||
meshTargetList.Add(meshTarget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Find Bone Objects
|
|
||||||
headObjectArray = new List<GameObject>();
|
|
||||||
foreach (string headString in headBoneName.Split(','))
|
|
||||||
{
|
|
||||||
GameObject headObject = GameObject.Find(headString);
|
|
||||||
if (headObject != null)
|
|
||||||
{
|
|
||||||
headObjectArray.Add(headObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rightEyeObjectArray = new List<GameObject>();
|
|
||||||
foreach (string rightEyeString in rightEyeBoneName.Split(','))
|
|
||||||
{
|
|
||||||
GameObject rightEyeObject = GameObject.Find(rightEyeString);
|
|
||||||
if (rightEyeObject != null)
|
|
||||||
{
|
|
||||||
rightEyeObjectArray.Add(rightEyeObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
leftEyeObjectArray = new List<GameObject>();
|
|
||||||
foreach (string leftEyeString in leftEyeBoneName.Split(','))
|
|
||||||
{
|
|
||||||
GameObject leftEyeObject = GameObject.Find(leftEyeString);
|
|
||||||
if (leftEyeObject != null)
|
|
||||||
{
|
|
||||||
leftEyeObjectArray.Add(leftEyeObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
headPositionObjectArray = new List<GameObject>();
|
|
||||||
foreach (string headPositionString in headPositionObjectName.Split(','))
|
|
||||||
{
|
|
||||||
GameObject headPositionObject = GameObject.Find(headPositionString);
|
|
||||||
if (headPositionObject != null)
|
|
||||||
{
|
|
||||||
headPositionObjectArray.Add(headPositionObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadMethod()
|
void ThreadMethod()
|
||||||
@ -289,8 +233,16 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
byte[] data = udp.Receive(ref remoteEP);
|
byte[] data = udp.Receive(ref remoteEP);
|
||||||
messageString = Encoding.ASCII.GetString(data);
|
messageString = Encoding.ASCII.GetString(data);
|
||||||
}
|
}
|
||||||
catch
|
catch (SocketException e)
|
||||||
{
|
{
|
||||||
|
if (e.SocketErrorCode != SocketError.TimedOut)
|
||||||
|
{
|
||||||
|
Debug.LogError($"[iFacialMocap] 데이터 수신 오류: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"[iFacialMocap] 예상치 못한 오류: {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
@ -24,7 +24,6 @@ using NaturalPoint;
|
|||||||
using NaturalPoint.NatNetLib;
|
using NaturalPoint.NatNetLib;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.UIElements;
|
using UnityEditor.UIElements;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
using static TMPro.SpriteAssetUtilities.TexturePacker_JsonArray;
|
using static TMPro.SpriteAssetUtilities.TexturePacker_JsonArray;
|
||||||
|
|
||||||
@ -341,7 +340,6 @@ public class OptitrackStreamingClient : MonoBehaviour
|
|||||||
private bool m_hasDrawnCameras = false;
|
private bool m_hasDrawnCameras = false;
|
||||||
private bool m_hasDrawnForcePlates = false;
|
private bool m_hasDrawnForcePlates = false;
|
||||||
private bool m_subscribedToMarkers = false;
|
private bool m_subscribedToMarkers = false;
|
||||||
private bool m_subscribedToTMarkMarkers = false; // trained markerset added
|
|
||||||
|
|
||||||
private OptitrackHiResTimer.Timestamp m_lastFrameDeliveryTimestamp;
|
private OptitrackHiResTimer.Timestamp m_lastFrameDeliveryTimestamp;
|
||||||
private Coroutine m_connectionHealthCoroutine = null;
|
private Coroutine m_connectionHealthCoroutine = null;
|
||||||
@ -611,7 +609,7 @@ public class OptitrackStreamingClient : MonoBehaviour
|
|||||||
/// <returns>An arbitrary OptitrackClient from the scene, or null if none are found.</returns>
|
/// <returns>An arbitrary OptitrackClient from the scene, or null if none are found.</returns>
|
||||||
public static OptitrackStreamingClient FindDefaultClient()
|
public static OptitrackStreamingClient FindDefaultClient()
|
||||||
{
|
{
|
||||||
OptitrackStreamingClient[] allClients = FindObjectsOfType<OptitrackStreamingClient>();
|
OptitrackStreamingClient[] allClients = FindObjectsByType<OptitrackStreamingClient>(FindObjectsSortMode.None);
|
||||||
|
|
||||||
if ( allClients.Length == 0 )
|
if ( allClients.Length == 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
BIN
Assets/ResourcesData/Character/00.R&D/TestVRM/Zonko_VRM.prefab
(Stored with Git LFS)
BIN
Assets/ResourcesData/Character/00.R&D/TestVRM/Zonko_VRM.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Scenes/Development scene.unity
(Stored with Git LFS)
BIN
Assets/Scenes/Development scene.unity
(Stored with Git LFS)
Binary file not shown.
@ -3,6 +3,7 @@ using UnityEngine.Rendering;
|
|||||||
using UnityEngine.Rendering.Universal;
|
using UnityEngine.Rendering.Universal;
|
||||||
using Klak.Spout;
|
using Klak.Spout;
|
||||||
using Klak.Ndi;
|
using Klak.Ndi;
|
||||||
|
using System;
|
||||||
|
|
||||||
// 출력 방식 열거형
|
// 출력 방식 열거형
|
||||||
public enum OutputMethod
|
public enum OutputMethod
|
||||||
@ -304,6 +305,7 @@ public class AlphaRecodingRenderPass : ScriptableRenderPass
|
|||||||
m_ShaderTexture = shaderTexture;
|
m_ShaderTexture = shaderTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("This method is obsolete. Use the new Render Graph API instead.")]
|
||||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -315,8 +317,11 @@ public class AlphaRecodingRenderPass : ScriptableRenderPass
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Update cameraColorTargetHandle usage
|
||||||
|
var colorTarget = renderingData.cameraData.renderer.cameraColorTargetHandle;
|
||||||
|
|
||||||
// 최종 렌더링 결과를 가져옵니다
|
// 최종 렌더링 결과를 가져옵니다
|
||||||
RenderTargetIdentifier source = renderingData.cameraData.renderer.cameraColorTargetHandle;
|
RenderTargetIdentifier source = colorTarget;
|
||||||
cmd.Blit(source, m_ShaderCameraTexture);
|
cmd.Blit(source, m_ShaderCameraTexture);
|
||||||
|
|
||||||
// ShaderCameraTexture를 ShaderContral의 _MainTex에 할당
|
// ShaderCameraTexture를 ShaderContral의 _MainTex에 할당
|
||||||
|
|||||||
@ -160,11 +160,7 @@ public class StreamingleAvatarExporter : EditorWindow
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 빌드 옵션 설정
|
// 빌드 옵션 설정
|
||||||
BuildAssetBundleOptions options = BuildAssetBundleOptions.ForceRebuildAssetBundle
|
BuildAssetBundleOptions options = BuildAssetBundleOptions.None;
|
||||||
| BuildAssetBundleOptions.StrictMode
|
|
||||||
| BuildAssetBundleOptions.DeterministicAssetBundle
|
|
||||||
| BuildAssetBundleOptions.DisableLoadAssetByFileName
|
|
||||||
| BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension;
|
|
||||||
|
|
||||||
// AssetBundle 빌드
|
// AssetBundle 빌드
|
||||||
BuildPipeline.BuildAssetBundles(
|
BuildPipeline.BuildAssetBundles(
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public class CameraManagerEditor : Editor
|
|||||||
if (GUILayout.Button("새 프리셋 추가", GUILayout.Height(30)))
|
if (GUILayout.Button("새 프리셋 추가", GUILayout.Height(30)))
|
||||||
{
|
{
|
||||||
// Scene에 있는 CinemachineCamera 컴포넌트를 가져와서 새 프리셋 생성
|
// Scene에 있는 CinemachineCamera 컴포넌트를 가져와서 새 프리셋 생성
|
||||||
var newCamera = GameObject.FindObjectOfType<CinemachineCamera>();
|
var newCamera = FindFirstObjectByType<CinemachineCamera>();
|
||||||
if (newCamera != null)
|
if (newCamera != null)
|
||||||
{
|
{
|
||||||
manager.cameraPresets.Add(new CameraManager.CameraPreset(newCamera));
|
manager.cameraPresets.Add(new CameraManager.CameraPreset(newCamera));
|
||||||
|
|||||||
BIN
Packages/manifest.json
(Stored with Git LFS)
BIN
Packages/manifest.json
(Stored with Git LFS)
Binary file not shown.
BIN
Packages/packages-lock.json
(Stored with Git LFS)
BIN
Packages/packages-lock.json
(Stored with Git LFS)
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user