diff --git a/Assets/Resources/RenderPipelines/UniversalRenderPipelineAsset.asset b/Assets/Resources/RenderPipelines/UniversalRenderPipelineAsset.asset index 8892d0b6..6f3329e0 100644 --- a/Assets/Resources/RenderPipelines/UniversalRenderPipelineAsset.asset +++ b/Assets/Resources/RenderPipelines/UniversalRenderPipelineAsset.asset @@ -36,8 +36,8 @@ MonoBehaviour: m_ShEvalMode: 0 m_MainLightRenderingMode: 1 m_MainLightShadowsSupported: 1 - m_MainLightShadowmapResolution: 2048 - m_AdditionalLightsRenderingMode: 0 + m_MainLightShadowmapResolution: 1024 + m_AdditionalLightsRenderingMode: 1 m_AdditionalLightsPerObjectLimit: 4 m_AdditionalLightShadowsSupported: 1 m_AdditionalLightsShadowmapResolution: 256 @@ -59,8 +59,8 @@ MonoBehaviour: m_ConservativeEnclosingSphere: 0 m_NumIterationsEnclosingSphere: 64 m_SoftShadowQuality: 2 - m_AdditionalLightsCookieResolution: 1024 - m_AdditionalLightsCookieFormat: 3 + m_AdditionalLightsCookieResolution: 512 + m_AdditionalLightsCookieFormat: 2 m_UseSRPBatcher: 1 m_SupportsDynamicBatching: 1 m_MixedLightingSupported: 1 diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 5f5c3be2..3bdbeee9 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -1850,6 +1850,7 @@ MonoBehaviour: - ../world_resources/app.gazebosim.org - ../world_resources/logistics_center/models - ../world_resources/smallhouse/models + - ../world_resources/meta-home/models _worldRootDirectories: - ../sample_resources/worlds/ - ../world_resources/bluepearl/worlds @@ -1857,10 +1858,12 @@ MonoBehaviour: - ../world_resources/seocho_tower/worlds - ../world_resources/logistics_center/worlds - ../world_resources/smallhouse/worlds + - ../world_resources/meta-home/worlds _fileRootDirectories: - ../sample_resources/media/ - ../world_resources/bluepearl/media - ../world_resources/lawn_ground + - ../world_resources/smallhouse --- !u!1 &314493398 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Devices/Modules/Base/DeviceHelper.cs b/Assets/Scripts/Devices/Modules/Base/DeviceHelper.cs index fb06fd73..985141ae 100644 --- a/Assets/Scripts/Devices/Modules/Base/DeviceHelper.cs +++ b/Assets/Scripts/Devices/Modules/Base/DeviceHelper.cs @@ -42,19 +42,15 @@ public static string GetModelName(in GameObject targetObject, in bool searchOnly { try { - var nextObject = targetObject.GetComponentInParent() as SDF.Helper.Base; + SDF.Helper.Base nextObject = targetObject.GetComponentInParent(); if (nextObject == null) { - nextObject = targetObject.GetComponentInParent() as SDF.Helper.Base; + nextObject = targetObject.GetComponentInParent(); } - if (nextObject == null) - { - return string.Empty; - } - - if (searchOnlyOneDepth == false) + if (searchOnlyOneDepth == false && nextObject != null && + !nextObject.CompareTag("Actor")) { while (!SDF2Unity.IsRootModel(nextObject.transform)) { @@ -62,11 +58,16 @@ public static string GetModelName(in GameObject targetObject, in bool searchOnly if (nextObject == null) { - return string.Empty; + break; } } } + if (nextObject == null) + { + return string.Empty; + } + return nextObject.name; } catch diff --git a/Assets/Scripts/Devices/Sonar.cs b/Assets/Scripts/Devices/Sonar.cs index 469e5b65..c3f6cae9 100644 --- a/Assets/Scripts/Devices/Sonar.cs +++ b/Assets/Scripts/Devices/Sonar.cs @@ -210,7 +210,7 @@ void OnTriggerStay(Collider other) var sonar = sonarStamped.Sonar; sonar.Range = detectedRange; sonar.Contact.Set(contactPoint); - // Debug.Log(deviceName + ": " + other.name + " |Stay| " + detectedRange.ToString("F5") + " | " + contactPoint); + // Debug.Log(DeviceName + ": " + other.name + " |Stay| " + detectedRange.ToString("F5") + " | " + contactPoint); pingpongindex++; pingpongindex %= 2; diff --git a/Assets/Scripts/Tools/Mesh/Assimp.Mesh.cs b/Assets/Scripts/Tools/Mesh/Assimp.Mesh.cs index 58e4ea8a..67c67d06 100644 --- a/Assets/Scripts/Tools/Mesh/Assimp.Mesh.cs +++ b/Assets/Scripts/Tools/Mesh/Assimp.Mesh.cs @@ -368,6 +368,11 @@ private static MeshMaterialList LoadMeshes(in List sceneMeshes) return meshMatList; } + private static Vector3 ToUnityScale(in Vector3 value) + { + return new Vector3(value.z, value.x, value.y); + } + private static GameObject ToUnityMeshObject( this Assimp.Node node, in MeshMaterialList meshMatList, @@ -400,9 +405,14 @@ private static GameObject ToUnityMeshObject( // Convert Assimp transfrom into Unity transform var nodeTransformMatrix = node.Transform.ToUnity(); + nodeObject.transform.localPosition = nodeTransformMatrix.GetPosition(); nodeObject.transform.localRotation = nodeTransformMatrix.rotation; - nodeObject.transform.localScale = nodeTransformMatrix.lossyScale; + nodeObject.transform.localScale = ToUnityScale(nodeTransformMatrix.lossyScale); + + // Debug.Log("ToUnityMeshObject : " + node.Name + ", " + nodeTransformMatrix.GetPosition() ); + // Debug.Log("ToUnityMeshObject : " + node.Name + ", " + nodeTransformMatrix.rotation ); + // Debug.Log("ToUnityMeshObject : " + node.Name + ", " + nodeTransformMatrix.lossyScale ); doFlip = (nodeObject.transform.localScale.x < 0 || nodeObject.transform.localScale.y < 0 || diff --git a/Assets/Scripts/Tools/SDF/Helper/Base.cs b/Assets/Scripts/Tools/SDF/Helper/Base.cs index 098e0c31..221e1135 100644 --- a/Assets/Scripts/Tools/SDF/Helper/Base.cs +++ b/Assets/Scripts/Tools/SDF/Helper/Base.cs @@ -53,8 +53,10 @@ public void Reset() private void UpdateRootModel() { var modelHelpers = GetComponentsInParent(typeof(Model)); - _rootModelInScopre = (Model)modelHelpers[modelHelpers.Length - 1]; - // UE.Debug.Log($"{name}: BaseHelper _rootModel={_rootModel}"); + if (modelHelpers.Length > 0) + { + _rootModelInScopre = (Model)modelHelpers[modelHelpers.Length - 1]; + } } public void ClearPose() diff --git a/Assets/Scripts/Tools/SDF/Import/Import.Base.cs b/Assets/Scripts/Tools/SDF/Import/Import.Base.cs index 3697b6fe..2c30f9c0 100644 --- a/Assets/Scripts/Tools/SDF/Import/Import.Base.cs +++ b/Assets/Scripts/Tools/SDF/Import/Import.Base.cs @@ -68,6 +68,8 @@ protected void ImportLinks(IReadOnlyList items, in Object parentObject) ImportSensors(item.GetSensors(), createdObject); + ImportLights(item.GetLights()); + AfterImportLink(item, createdObject); } } diff --git a/Assets/Scripts/Tools/SDF/Import/Import.Light.cs b/Assets/Scripts/Tools/SDF/Import/Import.Light.cs index 57a4fded..63ac0ecc 100644 --- a/Assets/Scripts/Tools/SDF/Import/Import.Light.cs +++ b/Assets/Scripts/Tools/SDF/Import/Import.Light.cs @@ -13,8 +13,6 @@ namespace Import { public partial class Loader : Base { - private const float DefaultLightIntensity = 50; - protected override void ImportLight(in Light light) { if (light == null) @@ -41,12 +39,14 @@ protected override void ImportLight(in Light light) var direction = SDF2Unity.Direction(light.direction); + var defaultLightDirection = UE.Quaternion.identity; + var defaultIntensity = 1f; + const float rangeIntensityRatio = 0.3f; switch (light.Type) { case "directional": lightComponent.type = UE.LightType.Directional; lightComponent.transform.localRotation = UE.Quaternion.LookRotation(UE.Vector3.down, direction); - break; case "spot": @@ -54,7 +54,8 @@ protected override void ImportLight(in Light light) lightComponent.spotAngle = (float)light.spot.outer_angle * Mathf.Rad2Deg; lightComponent.innerSpotAngle = (float)light.spot.inner_angle * Mathf.Rad2Deg; lightComponent.range = (float)light.attenuation.range; - lightComponent.intensity = (light.intensity.Equals(1)) ? DefaultLightIntensity : (float)light.intensity; + defaultIntensity = lightComponent.range * rangeIntensityRatio; + defaultLightDirection = UE.Quaternion.Euler(90, 0, 0); break; case "point": @@ -62,15 +63,19 @@ protected override void ImportLight(in Light light) lightComponent.type = UE.LightType.Point; lightComponent.range = (float)light.attenuation.range; lightComponent.transform.localRotation = UE.Quaternion.LookRotation(UE.Vector3.down, direction); - lightComponent.intensity = (light.intensity.Equals(1)) ? DefaultLightIntensity : (float)light.intensity; + defaultIntensity = lightComponent.range * rangeIntensityRatio; break; } + // TODO: Since element was introdueced from SDF 1.7, the intensity may not exist. + // As a workaround code, set half of range value for intensity. + lightComponent.intensity = (light.intensity.Equals(1)) ? defaultIntensity : (float)light.intensity; + var localPosition = SDF2Unity.Position(light.Pose?.Pos); var localRotation = SDF2Unity.Rotation(light.Pose?.Rot); newLightObject.transform.localPosition = localPosition; - newLightObject.transform.localRotation *= localRotation; + newLightObject.transform.localRotation *= (localRotation * defaultLightDirection); } } } diff --git a/Assets/Scripts/Tools/SDF/Import/Import.Link.cs b/Assets/Scripts/Tools/SDF/Import/Import.Link.cs index 299cc69c..5e177f37 100644 --- a/Assets/Scripts/Tools/SDF/Import/Import.Link.cs +++ b/Assets/Scripts/Tools/SDF/Import/Import.Link.cs @@ -80,11 +80,27 @@ protected override void AfterImportLink(in SDF.Link link, in System.Object targe return; } - var linkHelper = linkObject.GetComponent(); - // skip to create articulation body when inertial element is null + var modelHelpers = linkObject.GetComponentsInParent(); + + var hasStaticModel = false; + for (var i = 0; i < modelHelpers.Length; i++) + { + var modelHelper = modelHelpers[i]; + // Debug.LogWarning($"AfterImportLink: {linkObject.name} {modelHelper.name} {link.Name} {modelHelper.isStatic} {modelHelper.gameObject.isStatic}"); + if (modelHelper.isStatic) + { + hasStaticModel = true; + } + + if (modelHelper.IsFirstChild || hasStaticModel) + { + break; + } + } + var inertial = link.Inertial; - if (!linkHelper.Model.isStatic && inertial != null) + if (!hasStaticModel && inertial != null) { Loader.CreateArticulationBody(linkObject, inertial); } diff --git a/Assets/Scripts/Tools/SDF/Parser/Color.cs b/Assets/Scripts/Tools/SDF/Parser/Color.cs index 440fca4a..90342c17 100644 --- a/Assets/Scripts/Tools/SDF/Parser/Color.cs +++ b/Assets/Scripts/Tools/SDF/Parser/Color.cs @@ -53,5 +53,10 @@ public void FromString(string value) A = (double)Convert.ChangeType(tmp[3], TypeCode.Double); } + + public override string ToString() + { + return $"{base.ToString()} R={R:f5} G={G:f5} B={B:f5} A={A:f5}"; + } } } \ No newline at end of file diff --git a/Assets/Scripts/Tools/SDF/Parser/Light.cs b/Assets/Scripts/Tools/SDF/Parser/Light.cs index df6e8243..64b8e31e 100644 --- a/Assets/Scripts/Tools/SDF/Parser/Light.cs +++ b/Assets/Scripts/Tools/SDF/Parser/Light.cs @@ -83,7 +83,7 @@ protected override void ParseElements() if (IsValidNode("specular")) { - diffuse.FromString(GetValue("specular")); + specular.FromString(GetValue("specular")); } if (IsValidNode("attenuation")) diff --git a/Assets/Scripts/Tools/SDF/Parser/Link.cs b/Assets/Scripts/Tools/SDF/Parser/Link.cs index 93c37c25..27be18e7 100644 --- a/Assets/Scripts/Tools/SDF/Parser/Link.cs +++ b/Assets/Scripts/Tools/SDF/Parser/Link.cs @@ -65,9 +65,10 @@ public class Link : Entity private VelocityDecay _velocity_decay = null; private Inertial _inertial = null; - private Collisions collisions = null; - private Visuals visuals = null; - private Sensors sensors = null; + private Collisions _collisions = null; + private Visuals _visuals = null; + private Sensors _sensors = null; + private Lights _lights = null; // : TBD // : TBD @@ -96,9 +97,10 @@ public Link(XmlNode _node) protected override void ParseElements() { - collisions = new Collisions(root); - visuals = new Visuals(root); - sensors = new Sensors(root); + _collisions = new Collisions(root); + _visuals = new Visuals(root); + _sensors = new Sensors(root); + _lights = new Lights(root); gravity = GetValue("gravity", true); enable_wind = GetValue("enable_wind", false); @@ -152,17 +154,22 @@ protected override void ParseElements() public List GetCollisions() { - return collisions.GetData(); + return _collisions.GetData(); } public List GetVisuals() { - return visuals.GetData(); + return _visuals.GetData(); } public List GetSensors() { - return sensors.GetData(); + return _sensors.GetData(); + } + + public List GetLights() + { + return _lights.GetData(); } } } \ No newline at end of file diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 28d49de6..40740aee 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -44,16 +44,16 @@ GraphicsSettings: m_DefaultRenderingPath: 1 m_DefaultMobileRenderingPath: 1 m_TierSettings: [] - m_LightmapStripping: 0 + m_LightmapStripping: 1 m_FogStripping: 0 m_InstancingStripping: 0 m_BrgStripping: 0 - m_LightmapKeepPlain: 1 - m_LightmapKeepDirCombined: 1 + m_LightmapKeepPlain: 0 + m_LightmapKeepDirCombined: 0 m_LightmapKeepDynamicPlain: 1 m_LightmapKeepDynamicDirCombined: 1 - m_LightmapKeepShadowMask: 1 - m_LightmapKeepSubtractive: 1 + m_LightmapKeepShadowMask: 0 + m_LightmapKeepSubtractive: 0 m_FogKeepLinear: 1 m_FogKeepExp: 1 m_FogKeepExp2: 1 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index e21d0a7b..eaec2a83 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -140,7 +140,7 @@ PlayerSettings: loadStoreDebugModeEnabled: 0 visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 - bundleVersion: 4.9.1 + bundleVersion: 4.9.2 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0