diff --git a/Assets/UnitySensors/Runtime/Prefabs/Camera/PanoramicCamera.prefab b/Assets/UnitySensors/Runtime/Prefabs/Camera/PanoramicCamera.prefab new file mode 100644 index 00000000..7566eea8 --- /dev/null +++ b/Assets/UnitySensors/Runtime/Prefabs/Camera/PanoramicCamera.prefab @@ -0,0 +1,103 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6023160553514482222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6023160553514482209} + - component: {fileID: 6023160553514482210} + - component: {fileID: -5894630385440489856} + m_Layer: 0 + m_Name: PanoramicCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6023160553514482209 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6023160553514482222} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &6023160553514482210 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6023160553514482222} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!114 &-5894630385440489856 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6023160553514482222} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6618a3eeb546cbde1b85333be7bf7400, type: 3} + m_Name: + m_EditorClassIdentifier: + _frequency: 20 + k__BackingField: {x: 1920, y: 270} + k__BackingField: 30 + k__BackingField: 0.05 + k__BackingField: 100 diff --git a/Assets/UnitySensors/Runtime/Prefabs/Camera/PanoramicCamera.prefab.meta b/Assets/UnitySensors/Runtime/Prefabs/Camera/PanoramicCamera.prefab.meta new file mode 100644 index 00000000..d6c7b7ed --- /dev/null +++ b/Assets/UnitySensors/Runtime/Prefabs/Camera/PanoramicCamera.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 52e28e39a14b84942b87b6309310868b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/CameraSensor.cs b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/CameraSensor.cs index 95881da9..85492c6a 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/CameraSensor.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/CameraSensor.cs @@ -8,51 +8,43 @@ namespace UnitySensors.Sensor.Camera [RequireComponent(typeof(UnityEngine.Camera))] public abstract class CameraSensor : UnitySensor, ITextureInterface { - [SerializeField] - private Vector2Int _resolution = new Vector2Int(640, 480); - [SerializeField] - private float _fov = 30.0f; - [SerializeField] - private float _minRange = 0.05f; - [SerializeField] - private float _maxRange = 100.0f; + [field: SerializeField] public Vector2Int resolution { get; protected set; } = new(640, 480); + [field: SerializeField] public float fov { get; protected set; } = 30.0f; + [field: SerializeField] public float minRange { get; protected set; } = 0.05f; + [field: SerializeField] public float maxRange { get; protected set; } = 100.0f; - private UnityEngine.Camera _m_camera; - private RenderTexture _rt = null; - private Texture2D _texture; - private byte[] _data; - - public Vector2Int resolution { get => _resolution; } - protected float maxRange { get => _maxRange; } - public UnityEngine.Camera m_camera { get => _m_camera; } - public Texture2D texture { get => _texture; } - public byte[] data { get => _data; } - public int width { get => _resolution.x; } - public int height { get => _resolution.y; } - public string encoding { get => "rgb8"; } + public UnityEngine.Camera sensorCamera { get; protected set; } + public byte[] data { get; protected set; } + public string encoding { get; protected set; } + public int width { get => resolution.x; } + public int height { get => resolution.y; } + public Texture2D texture { get; protected set; } + protected RenderTexture _rt; protected override void Init() { - _m_camera = GetComponent(); - _m_camera.fieldOfView = _fov; - _m_camera.nearClipPlane = _minRange; - _m_camera.farClipPlane = _maxRange; - - _rt = new RenderTexture(_resolution.x, _resolution.y, 16, RenderTextureFormat.ARGB32); - _m_camera.targetTexture = _rt; + sensorCamera = GetComponent(); + sensorCamera.fieldOfView = fov; + sensorCamera.nearClipPlane = minRange; + sensorCamera.farClipPlane = maxRange; - _texture = new Texture2D(width, height, TextureFormat.RGB24, false); + if( _rt == null ) + { + _rt = new RenderTexture(width, height, 16, RenderTextureFormat.ARGB32); + sensorCamera.targetTexture = _rt; + } - _data = new byte[width * height * 3]; + texture = new Texture2D(width, height, TextureFormat.RGB24, false); + data = new byte[width * height * 3]; + encoding = "rgb8"; } protected override void UpdateSensor() { if (!LoadTexture()) return; - if (onSensorUpdated != null) - onSensorUpdated.Invoke(); + onSensorUpdated?.Invoke(); } protected bool LoadTexture() @@ -71,17 +63,17 @@ protected bool LoadTexture() int j=width*(height-1)*4; for(int y=0; y(_pointsNum, Allocator.Persistent); - float z = resolution.y * 0.5f / Mathf.Tan(m_camera.fieldOfView * 0.5f * Mathf.Deg2Rad); - for (int y = 0; y < resolution.y; y++) + float z = height * 0.5f / Mathf.Tan(sensorCamera.fieldOfView * 0.5f * Mathf.Deg2Rad); + for (int y = 0; y < height; y++) { - for (int x = 0; x < resolution.x; x++) + for (int x = 0; x < width; x++) { - Vector3 vec = new Vector3(-resolution.x / 2 + x, -resolution.y / 2 + y, z); - _directions[y * resolution.x + x] = vec.normalized; + Vector3 vec = new Vector3(-width / 2 + x, -height / 2 + y, z); + _directions[y * width + x] = vec.normalized; } } } @@ -79,12 +79,12 @@ private void SetupJob() _textureToPointsJob = new ITextureToPointsJob() { - near= m_camera.nearClipPlane, - far = m_camera.farClipPlane, + near = sensorCamera.nearClipPlane, + far = sensorCamera.farClipPlane, directions = _directions, - pixels = texture.GetPixelData(0), - noises = _noises, - points = _pointCloud.points + pixels = texture.GetPixelData(0), + noises = _noises, + points = _pointCloud.points }; } @@ -97,8 +97,7 @@ protected override void UpdateSensor() JobHandle.ScheduleBatchedJobs(); _jobHandle.Complete(); - if (onSensorUpdated != null) - onSensorUpdated.Invoke(); + onSensorUpdated?.Invoke(); } protected override void OnSensorDestroy() diff --git a/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera.meta b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera.meta new file mode 100644 index 00000000..9014af1a --- /dev/null +++ b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98c13f9cc7348e625809c7222f1dd1e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera/PanoramicCameraSensor.cs b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera/PanoramicCameraSensor.cs new file mode 100644 index 00000000..44213306 --- /dev/null +++ b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera/PanoramicCameraSensor.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace UnitySensors.Sensor.Camera +{ + public class PanoramicCameraSensor : CameraSensor + { + private Material _mat; + private RenderTexture _cubemap; + + protected override void Init() + { + _cubemap = new RenderTexture(1024, 1024, 16, RenderTextureFormat.ARGB32) + { + dimension = UnityEngine.Rendering.TextureDimension.Cube + }; + _rt = new RenderTexture(width, height, 16, RenderTextureFormat.ARGB32); + _mat = new Material(Shader.Find("UnitySensors/Panoramic")); + base.Init(); + } + + protected override void UpdateSensor() + { + _mat.SetVector("_Rotation", transform.eulerAngles); + sensorCamera.RenderToCubemap(_cubemap); + Graphics.Blit(_cubemap, _rt, _mat); + + if (!LoadTexture()) return; + onSensorUpdated?.Invoke(); + } + } +} \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera/PanoramicCameraSensor.cs.meta b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera/PanoramicCameraSensor.cs.meta new file mode 100644 index 00000000..c5de2cb7 --- /dev/null +++ b/Assets/UnitySensors/Runtime/Scripts/Sensors/Camera/PanoramicCamera/PanoramicCameraSensor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6618a3eeb546cbde1b85333be7bf7400 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnitySensors/Runtime/Shaders/Panoramic.shader b/Assets/UnitySensors/Runtime/Shaders/Panoramic.shader new file mode 100644 index 00000000..3acaf2cb --- /dev/null +++ b/Assets/UnitySensors/Runtime/Shaders/Panoramic.shader @@ -0,0 +1,96 @@ +Shader "UnitySensors/Panoramic" +{ + + Properties + { + [NoScaleOffset] _MainTex("Cubemap", Cube) = "" {} + _Rotation("Rotation", Vector) = (0, 0, 0, 0) + } + + Subshader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma fragmentoption ARB_precision_hint_fastest + #include "UnityCG.cginc" + + #define PI 3.141592653589793 + #define TAU 6.283185307179587 + + float3 _Rotation; + samplerCUBE _MainTex; + + struct v2f { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + v2f vert(appdata_img v) + { + v2f o; + o.pos = UnityObjectToClipPos(v.vertex); + o.uv = v.texcoord.xy; + return o; + } + + float3 EquirectangularProjection(float2 In) + { + float a = In.x * TAU; + float b = In.y * PI; + + return float3( + -sin(a) * sin(b), + -cos(b), + -cos(a) * sin(b) + ); + } + + float3x3 EulerToRotMatrix(float3 In) + { + // Inspired from + // https://github.com/whdlgp/Equirectangular_rotate/blob/master/equirectangular_rotate.py + float3 s = sin(In); + float3 c = cos(In); + + float3x3 x = float3x3( + float3(1, 0, 0), + float3(0, c.x, -s.x), + float3(0, s.x, c.x) + ); + + float3x3 y = float3x3( + float3( c.y, 0, s.y), + float3( 0, 1, 0), + float3(-s.y, 0, c.y) + ); + + float3x3 z = float3x3( + float3(c.z, -s.z, 0), + float3(s.z, c.z, 0), + float3( 0, 0, 1) + ); + + return mul(mul(x,y),z); + } + + fixed4 frag(v2f i) : COLOR + { + float3 unit = EquirectangularProjection(i.uv); + float3x3 rotMatrix = EulerToRotMatrix(mul(_Rotation,PI/180.0)); + + unit = mul(rotMatrix, unit); + + return texCUBE(_MainTex, unit); + } + + ENDCG + } + } + Fallback Off +} \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Shaders/Panoramic.shader.meta b/Assets/UnitySensors/Runtime/Shaders/Panoramic.shader.meta new file mode 100644 index 00000000..e4d3caa4 --- /dev/null +++ b/Assets/UnitySensors/Runtime/Shaders/Panoramic.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 569ddeeee83cba249ab918801ca7ccc2 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnitySensors/Samples/Camera/Demo_PanoramicCamera.unity b/Assets/UnitySensors/Samples/Camera/Demo_PanoramicCamera.unity new file mode 100644 index 00000000..27ad9e2c --- /dev/null +++ b/Assets/UnitySensors/Samples/Camera/Demo_PanoramicCamera.unity @@ -0,0 +1,742 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &407419871 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 407419873} + - component: {fileID: 407419872} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &407419872 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407419871} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &407419873 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407419871} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &445338813 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 445338817} + - component: {fileID: 445338816} + - component: {fileID: 445338815} + - component: {fileID: 445338814} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &445338814 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 445338813} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &445338815 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 445338813} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &445338816 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 445338813} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &445338817 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 445338813} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1896987095} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!4 &952137284 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2848956544552890604, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + m_PrefabInstance: {fileID: 1800507287} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1307186000 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 952137284} + m_Modifications: + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalPosition.y + value: 1.6 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6023160553514482222, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + propertyPath: m_Name + value: PanoramicCamera + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 6023160553514482222, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + insertIndex: -1 + addedObject: {fileID: 1752418546} + m_SourcePrefab: {fileID: 100100000, guid: 52e28e39a14b84942b87b6309310868b, type: 3} +--- !u!1 &1437038471 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1437038474} + - component: {fileID: 1437038473} + - component: {fileID: 1437038472} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1437038472 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437038471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1437038473 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437038471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &1437038474 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437038471} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1752418544 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6023160553514482222, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + m_PrefabInstance: {fileID: 1307186000} + m_PrefabAsset: {fileID: 0} +--- !u!4 &1752418545 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6023160553514482209, guid: 52e28e39a14b84942b87b6309310868b, + type: 3} + m_PrefabInstance: {fileID: 1307186000} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1752418546 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1752418544} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc838544d115b7741a2cb963bc058b29, type: 3} + m_Name: + m_EditorClassIdentifier: + _image: {fileID: 1896987096} +--- !u!1001 &1800507287 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060222, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848956545337060223, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + propertyPath: m_Name + value: DemoEnv + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 2848956544552890604, guid: 581b84ef57339314c92df1cef0a06b47, + type: 3} + insertIndex: -1 + addedObject: {fileID: 1752418545} + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 581b84ef57339314c92df1cef0a06b47, type: 3} +--- !u!1 &1896987094 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1896987095} + - component: {fileID: 1896987097} + - component: {fileID: 1896987096} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1896987095 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1896987094} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 445338817} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -40, y: 480} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1896987096 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1896987094} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &1896987097 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1896987094} + m_CullTransparentMesh: 1 +--- !u!1 &2021466618 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2021466621} + - component: {fileID: 2021466620} + - component: {fileID: 2021466619} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2021466619 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2021466618} + m_Enabled: 1 +--- !u!20 &2021466620 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2021466618} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.7195621, g: 0.79927117, b: 0.9245283, a: 1} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &2021466621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2021466618} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 100, y: 1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 407419873} + - {fileID: 1800507287} + - {fileID: 445338817} + - {fileID: 1437038474} + - {fileID: 2021466621} diff --git a/Assets/UnitySensors/Samples/Camera/Demo_PanoramicCamera.unity.meta b/Assets/UnitySensors/Samples/Camera/Demo_PanoramicCamera.unity.meta new file mode 100644 index 00000000..63c5c77b --- /dev/null +++ b/Assets/UnitySensors/Samples/Camera/Demo_PanoramicCamera.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3a06a558030955f40bf932071a261f0f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Camera/CameraInfoMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Camera/CameraInfoMsgSerializer.cs index 83cc110b..5d487193 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Camera/CameraInfoMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Camera/CameraInfoMsgSerializer.cs @@ -19,7 +19,7 @@ public override void Init(CameraSensor sensor) public override CameraInfoMsg Serialize() { - _msg = CameraInfoGenerator.ConstructCameraInfoMessage(sensor.m_camera, _header.Serialize()); + _msg = CameraInfoGenerator.ConstructCameraInfoMessage(sensor.sensorCamera, _header.Serialize()); return _msg; } } diff --git a/README.md b/README.md index 35aef143..c271f6cd 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ The following sensors are available inside : - Livox 3D LiDAR(Avia, Horizon, Mid40, Mid70, Tele, HAP, Mid360) - RGB Camera - RGBD Camera +- Panoramic Camera - IMU - GNSS - (GroundTruth)