Browse Source

shader lerp added

audio
Cailean Finn 5 months ago
parent
commit
6b5ee3a8a0
  1. 90
      Assets/5_Scenes/DreconDemo.unity
  2. 16
      Assets/8_Scripts/1_Managers/Model Manager.cs
  3. 2
      Assets/9_Models/Humanoid/SMPLX_Texture/smplx texture human.mat
  4. 2
      Assets/ML-Agents/Timers/DreconDemo_timers.json

90
Assets/5_Scenes/DreconDemo.unity

@ -919,22 +919,22 @@ LineRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_Positions: m_Positions:
- {x: -412.7127, y: -21.951141, z: -292.2906} - {x: -363.73016, y: -22.08435, z: -290.50977}
- {x: -133.86412, y: -21.951141, z: -292.2906} - {x: -134.61612, y: -22.08435, z: -290.50977}
- {x: -133.86412, y: -21.951141, z: -93.21399} - {x: -134.61612, y: -22.08435, z: -70.51155}
- {x: -412.7127, y: -21.951141, z: -93.21399} - {x: -363.73016, y: -22.08435, z: -70.51155}
- {x: -412.7127, y: -21.951141, z: -292.2906} - {x: -363.73016, y: -22.08435, z: -290.50977}
- {x: -412.7127, y: 462.59784, z: -292.2906} - {x: -363.73016, y: 420.60223, z: -290.50977}
- {x: -133.86412, y: 462.59784, z: -292.2906} - {x: -134.61612, y: 420.60223, z: -290.50977}
- {x: -133.86412, y: -21.951141, z: -292.2906} - {x: -134.61612, y: -22.08435, z: -290.50977}
- {x: -133.86412, y: 462.59784, z: -292.2906} - {x: -134.61612, y: 420.60223, z: -290.50977}
- {x: -133.86412, y: 462.59784, z: -93.21399} - {x: -134.61612, y: 420.60223, z: -70.51155}
- {x: -133.86412, y: -21.951141, z: -93.21399} - {x: -134.61612, y: -22.08435, z: -70.51155}
- {x: -133.86412, y: 462.59784, z: -93.21399} - {x: -134.61612, y: 420.60223, z: -70.51155}
- {x: -412.7127, y: 462.59784, z: -93.21399} - {x: -363.73016, y: 420.60223, z: -70.51155}
- {x: -412.7127, y: -21.951141, z: -93.21399} - {x: -363.73016, y: -22.08435, z: -70.51155}
- {x: -412.7127, y: 462.59784, z: -93.21399} - {x: -363.73016, y: 420.60223, z: -70.51155}
- {x: -412.7127, y: 462.59784, z: -292.2906} - {x: -363.73016, y: 420.60223, z: -290.50977}
m_Parameters: m_Parameters:
serializedVersion: 3 serializedVersion: 3
widthMultiplier: 1 widthMultiplier: 1
@ -1268,7 +1268,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62178361} m_GameObject: {fileID: 62178361}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.12400308, y: -0.092653364, z: 0.011630281, w: 0.9878782} m_LocalRotation: {x: 0.12400306, y: -0.09265334, z: 0.011630276, w: 0.9878782}
m_LocalPosition: {x: 24.371735, y: 51, z: -83.27547} m_LocalPosition: {x: 24.371735, y: 51, z: -83.27547}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -3872,7 +3872,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320225263} m_GameObject: {fileID: 320225263}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.10993206, y: 0.8057201, z: -0.5601094, w: -0.1581378} m_LocalRotation: {x: -0.10993547, y: 0.8057193, z: -0.56010836, w: -0.15814286}
m_LocalPosition: {x: 146.21146, y: 328.1435, z: -324.69598} m_LocalPosition: {x: 146.21146, y: 328.1435, z: -324.69598}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -3902,7 +3902,7 @@ MonoBehaviour:
m_Follow: {fileID: 1683887270} m_Follow: {fileID: 1683887270}
m_Lens: m_Lens:
FieldOfView: 0.3993083 FieldOfView: 0.3993083
OrthographicSize: 0.429782 OrthographicSize: 0.2584939
NearClipPlane: 0.01 NearClipPlane: 0.01
FarClipPlane: 5000 FarClipPlane: 5000
Dutch: 0 Dutch: 0
@ -3983,7 +3983,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 326736459} m_GameObject: {fileID: 326736459}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.07396109, y: 0.9066138, z: 0.17882524, w: 0.37497023} m_LocalRotation: {x: -0.073961094, y: 0.9066138, z: 0.17882526, w: 0.3749702}
m_LocalPosition: {x: 17.7008, y: 8.655965, z: -0.081218004} m_LocalPosition: {x: 17.7008, y: 8.655965, z: -0.081218004}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -4194,7 +4194,7 @@ Camera:
far clip plane: 5000 far clip plane: 5000
field of view: 0.3993083 field of view: 0.3993083
orthographic: 1 orthographic: 1
orthographic size: 0.429782 orthographic size: 0.2584939
m_Depth: -1 m_Depth: -1
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
@ -4218,7 +4218,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543} m_GameObject: {fileID: 330585543}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.10993206, y: 0.8057201, z: -0.5601094, w: -0.1581378} m_LocalRotation: {x: -0.10993547, y: 0.8057193, z: -0.56010836, w: -0.15814286}
m_LocalPosition: {x: 146.21146, y: 328.1435, z: -324.69598} m_LocalPosition: {x: 146.21146, y: 328.1435, z: -324.69598}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -4245,7 +4245,7 @@ MonoBehaviour:
m_BlendUpdateMethod: 1 m_BlendUpdateMethod: 1
m_DefaultBlend: m_DefaultBlend:
m_Style: 1 m_Style: 1
m_Time: 13 m_Time: 11
m_CustomCurve: m_CustomCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: [] m_Curve: []
@ -6478,7 +6478,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &459103777 --- !u!224 &459103777
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -11393,7 +11393,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 882491594} m_GameObject: {fileID: 882491594}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.25553274, y: 0.66416085, z: -0.6526689, w: 0.26003215} m_LocalRotation: {x: 0.25553566, y: 0.6641597, z: -0.6526678, w: 0.26003498}
m_LocalPosition: {x: 18.100853, y: 10.055965, z: -0.48116565} m_LocalPosition: {x: 18.100853, y: 10.055965, z: -0.48116565}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -18150,6 +18150,13 @@ MonoBehaviour:
Data3: -567375949 Data3: -567375949
Data4: 1149958008 Data4: 1149958008
Path: event:/Music Path: event:/Music
m_CameraSwitch:
Guid:
Data1: 469091627
Data2: 1332214813
Data3: -91639392
Data4: -1606552961
Path: event:/CameraSwitch
--- !u!1 &1433776418 --- !u!1 &1433776418
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -23865,22 +23872,22 @@ LineRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_Positions: m_Positions:
- {x: -60.598137, y: -17.702927, z: -248.73778} - {x: -95.44005, y: -18.11766, z: -261.12744}
- {x: 158.00845, y: -17.702927, z: -248.73778} - {x: 164.57597, y: -18.11766, z: -261.12744}
- {x: 158.00845, y: -17.702927, z: -7.0879364} - {x: 164.57597, y: -18.11766, z: -21.665466}
- {x: -60.598137, y: -17.702927, z: -7.0879364} - {x: -95.44005, y: -18.11766, z: -21.665466}
- {x: -60.598137, y: -17.702927, z: -248.73778} - {x: -95.44005, y: -18.11766, z: -261.12744}
- {x: -60.598137, y: 444.79578, z: -248.73778} - {x: -95.44005, y: 437.8023, z: -261.12744}
- {x: 158.00845, y: 444.79578, z: -248.73778} - {x: 164.57597, y: 437.8023, z: -261.12744}
- {x: 158.00845, y: -17.702927, z: -248.73778} - {x: 164.57597, y: -18.11766, z: -261.12744}
- {x: 158.00845, y: 444.79578, z: -248.73778} - {x: 164.57597, y: 437.8023, z: -261.12744}
- {x: 158.00845, y: 444.79578, z: -7.0879364} - {x: 164.57597, y: 437.8023, z: -21.665466}
- {x: 158.00845, y: -17.702927, z: -7.0879364} - {x: 164.57597, y: -18.11766, z: -21.665466}
- {x: 158.00845, y: 444.79578, z: -7.0879364} - {x: 164.57597, y: 437.8023, z: -21.665466}
- {x: -60.598137, y: 444.79578, z: -7.0879364} - {x: -95.44005, y: 437.8023, z: -21.665466}
- {x: -60.598137, y: -17.702927, z: -7.0879364} - {x: -95.44005, y: -18.11766, z: -21.665466}
- {x: -60.598137, y: 444.79578, z: -7.0879364} - {x: -95.44005, y: 437.8023, z: -21.665466}
- {x: -60.598137, y: 444.79578, z: -248.73778} - {x: -95.44005, y: 437.8023, z: -261.12744}
m_Parameters: m_Parameters:
serializedVersion: 3 serializedVersion: 3
widthMultiplier: 1 widthMultiplier: 1
@ -36961,6 +36968,7 @@ MonoBehaviour:
m_InitialModel: {fileID: 5022602860645237092, guid: 0e791689cf0300c4fbe8be76f09fccff, m_InitialModel: {fileID: 5022602860645237092, guid: 0e791689cf0300c4fbe8be76f09fccff,
type: 3} type: 3}
m_DirectoryPath: '../nnmodels ' m_DirectoryPath: '../nnmodels '
m_HumanMaterial: {fileID: 2100000, guid: 597337d36e2278c4db0ba474300e988f, type: 2}
--- !u!4 &7431187848490878806 --- !u!4 &7431187848490878806
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

16
Assets/8_Scripts/1_Managers/Model Manager.cs

@ -22,9 +22,14 @@ public class ModelManager : MonoBehaviour
private BehaviorParameters m_Parameters; private BehaviorParameters m_Parameters;
private RagDollAgent m_Agent; private RagDollAgent m_Agent;
private float m_ModelProgress = 0f;
// Unity Events // // Unity Events //
public delegate void onUpdateModelNameDelegate(float modelName); public delegate void onUpdateModelNameDelegate(float modelName);
public static onUpdateModelNameDelegate m_UpdateModelName; public static onUpdateModelNameDelegate m_UpdateModelName;
public Material m_HumanMaterial;
private void OnEnable() private void OnEnable()
{ {
RagDollAgent.m_MoveToNextModel += SwapModel; RagDollAgent.m_MoveToNextModel += SwapModel;
@ -55,6 +60,7 @@ public class ModelManager : MonoBehaviour
{ {
m_Agent.SetModel("DReCon-v0", model, InferenceDevice.Burst); m_Agent.SetModel("DReCon-v0", model, InferenceDevice.Burst);
UpdateModelName(); UpdateModelName();
CalculateModelProgress();
} }
private void LoadLocalModels() private void LoadLocalModels()
@ -104,4 +110,14 @@ public class ModelManager : MonoBehaviour
m_UpdateModelName?.Invoke(float.Parse(m_ModelName)); m_UpdateModelName?.Invoke(float.Parse(m_ModelName));
} }
} }
private void CalculateModelProgress()
{
m_ModelProgress = ((float)(m_CurrentModel + 1) ) / ((float)m_ModelList.Count);
Debug.Log($"{m_ModelList.Count}, {m_CurrentModel + 1f}, {m_ModelProgress}");
if (m_HumanMaterial != null)
{
m_HumanMaterial.SetFloat("_LerpTexture", m_ModelProgress);
}
}
} }

2
Assets/9_Models/Humanoid/SMPLX_Texture/smplx texture human.mat

@ -205,7 +205,7 @@ Material:
- _Ior: 1.5 - _Ior: 1.5
- _IridescenceMask: 1 - _IridescenceMask: 1
- _IridescenceThickness: 1 - _IridescenceThickness: 1
- _LerpTexture: 0.848 - _LerpTexture: 1
- _LinkDetailsWithBase: 1 - _LinkDetailsWithBase: 1
- _MaterialID: 1 - _MaterialID: 1
- _Metallic: 0 - _Metallic: 0

2
Assets/ML-Agents/Timers/DreconDemo_timers.json

@ -1 +1 @@
{"count":1,"self":128.62777599999998,"total":133.6115917,"children":{"InitializeActuators":{"count":1,"self":0.0015666,"total":0.0015666,"children":null},"InitializeSensors":{"count":1,"self":0.001,"total":0.001,"children":null},"AgentSendState":{"count":7598,"self":0.053791399999999996,"total":1.6417686,"children":{"CollectObservations":{"count":3799,"self":1.5508513,"total":1.5508513,"children":null},"WriteActionMask":{"count":3799,"self":0.0123361,"total":0.0123361,"children":null},"RequestDecision":{"count":3799,"self":0.024789799999999997,"total":0.024789799999999997,"children":null}}},"DecideAction":{"count":7598,"self":2.3099756,"total":2.3099756,"children":null},"AgentAct":{"count":7598,"self":1.028495,"total":1.028495,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1717416385","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\drecon-unity -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-cail -hubSessionId cfc8f2a9-0537-4fba-b070-f880e52effa9 -accessToken _5JvzjJIQvBt0od_zI7MaK1dhKrYADPo_KWmtnyaPac005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1717416519"}} {"count":1,"self":59.2524352,"total":61.562041,"children":{"InitializeActuators":{"count":1,"self":0.0010125,"total":0.0010125,"children":null},"InitializeSensors":{"count":1,"self":0.001,"total":0.001,"children":null},"AgentSendState":{"count":3269,"self":0.0395545,"total":0.739135,"children":{"CollectObservations":{"count":1635,"self":0.6764796,"total":0.6764796,"children":null},"WriteActionMask":{"count":1635,"self":0.0015765,"total":0.0015765,"children":null},"RequestDecision":{"count":1635,"self":0.0215244,"total":0.0215244,"children":null}}},"DecideAction":{"count":3269,"self":1.0155372,"total":1.0155372,"children":null},"AgentAct":{"count":3269,"self":0.55191669999999993,"total":0.55191669999999993,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1717418112","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\drecon-unity -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-cail -hubSessionId cfc8f2a9-0537-4fba-b070-f880e52effa9 -accessToken _5JvzjJIQvBt0od_zI7MaK1dhKrYADPo_KWmtnyaPac005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1717418174"}}
Loading…
Cancel
Save