diff --git a/Assets/Escape Room Engine/Portal/PlayerCamera.cs b/Assets/Escape Room Engine/Portal/PlayerCamera.cs index 31985dc..d47bc81 100644 --- a/Assets/Escape Room Engine/Portal/PlayerCamera.cs +++ b/Assets/Escape Room Engine/Portal/PlayerCamera.cs @@ -4,10 +4,10 @@ namespace Escape_Room_Engine.Portal { public class PlayerCamera : MonoBehaviour { - public Camera camera; + public new Camera camera; [SerializeField] private Transform leftEye, rightEye; - public Transform getEyeTransform(Camera.StereoscopicEye eye) => + public Transform GetEyeTransform(Camera.StereoscopicEye eye) => eye == Camera.StereoscopicEye.Left ? leftEye : rightEye; } } diff --git a/Assets/Escape Room Engine/Portal/Portal Frame.blend b/Assets/Escape Room Engine/Portal/Portal Frame.blend index 1f29a1f..6980a4c 100644 Binary files a/Assets/Escape Room Engine/Portal/Portal Frame.blend and b/Assets/Escape Room Engine/Portal/Portal Frame.blend differ diff --git a/Assets/Escape Room Engine/Portal/Portal Frame.blend.meta b/Assets/Escape Room Engine/Portal/Portal Frame.blend.meta index 142c7f3..b5244dc 100644 --- a/Assets/Escape Room Engine/Portal/Portal Frame.blend.meta +++ b/Assets/Escape Room Engine/Portal/Portal Frame.blend.meta @@ -51,7 +51,7 @@ ModelImporter: useFileUnits: 1 keepQuads: 0 weldVertices: 1 - bakeAxisConversion: 0 + bakeAxisConversion: 1 preserveHierarchy: 0 skinWeightsMode: 0 maxBonesPerVertex: 4 diff --git a/Assets/Escape Room Engine/Portal/Portal Frame.blend1 b/Assets/Escape Room Engine/Portal/Portal Frame.blend1 index 7331275..1c20a7a 100644 Binary files a/Assets/Escape Room Engine/Portal/Portal Frame.blend1 and b/Assets/Escape Room Engine/Portal/Portal Frame.blend1 differ diff --git a/Assets/Escape Room Engine/Portal/Portal Screen.blend b/Assets/Escape Room Engine/Portal/Portal Screen.blend new file mode 100644 index 0000000..6e6d4ab Binary files /dev/null and b/Assets/Escape Room Engine/Portal/Portal Screen.blend differ diff --git a/Assets/Escape Room Engine/Portal/Portal Screen.blend.meta b/Assets/Escape Room Engine/Portal/Portal Screen.blend.meta new file mode 100644 index 0000000..e857b10 --- /dev/null +++ b/Assets/Escape Room Engine/Portal/Portal Screen.blend.meta @@ -0,0 +1,106 @@ +fileFormatVersion: 2 +guid: 45a0860e0db749d4881818b0d8d3d0b4 +ModelImporter: + serializedVersion: 21300 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + removeConstantScaleCurves: 1 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + nodeNameCollisionStrategy: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 1 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + optimizeBones: 1 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + remapMaterialsIfMaterialImportModeIsNone: 0 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Portal/Portal Screen.blend1 b/Assets/Escape Room Engine/Portal/Portal Screen.blend1 new file mode 100644 index 0000000..1492b09 Binary files /dev/null and b/Assets/Escape Room Engine/Portal/Portal Screen.blend1 differ diff --git a/Assets/Escape Room Engine/Portal/Portal Screen.blend1.meta b/Assets/Escape Room Engine/Portal/Portal Screen.blend1.meta new file mode 100644 index 0000000..57d58ca --- /dev/null +++ b/Assets/Escape Room Engine/Portal/Portal Screen.blend1.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b5ae4b2ffa7168645b783530527a95fc +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Portal/Portal.cs b/Assets/Escape Room Engine/Portal/Portal.cs index 641baeb..b8acb71 100644 --- a/Assets/Escape Room Engine/Portal/Portal.cs +++ b/Assets/Escape Room Engine/Portal/Portal.cs @@ -1,23 +1,74 @@ using System; +using System.Collections.Generic; using UnityEngine; namespace Escape_Room_Engine.Portal { + [RequireComponent(typeof(Collider))] public class Portal : MonoBehaviour { + public static readonly Matrix4x4 HalfRotation = Matrix4x4.Rotate(Quaternion.Euler(0, 180, 0)); + /// /// The portal that is connected with this one. /// - public Portal other; + public Portal linkedPortal; /// /// The camera that will draw the view for this portal. /// public PortalCamera portalCamera; + private readonly List _closePortalDrivers = new(); + private void Awake() { // check whether the other portal is set up - if (!other || other.other != this) throw new Exception("Other portal not set up correctly."); + if (!linkedPortal || linkedPortal.linkedPortal != this) throw new Exception("Other portal not set up correctly."); + + // check whether the collider is set up correctly + if (!GetComponent().isTrigger) throw new Exception("Collider must be a trigger."); + } + + private void LateUpdate() + { + for (var i = 0; i < _closePortalDrivers.Count; i++) + { + var portalDriver = _closePortalDrivers[i]; + var side = CalculateSide(portalDriver.transform); + if (portalDriver.entrySide < 0 && side >= 0) // must have entered from the front and exited the back + { + _closePortalDrivers.Remove(portalDriver); + linkedPortal._closePortalDrivers.Add(portalDriver); + portalDriver.entrySide = -1; + portalDriver.Teleport(this, linkedPortal); + i--; // decrease the loop counter because the list is one element smaller now + } + } + } + + private void OnTriggerEnter(Collider other) + { + var portalDriver = other.GetComponent(); + if (portalDriver && !_closePortalDrivers.Contains(portalDriver)) + { + _closePortalDrivers.Add(portalDriver); + portalDriver.entrySide = CalculateSide(portalDriver.transform); + } + } + + private void OnTriggerExit(Collider other) + { + var portalDriver = other.GetComponent(); + if (portalDriver) + { + _closePortalDrivers.Remove(portalDriver); + } + } + + private int CalculateSide(Transform portalDriverTransform) + { + var t = transform; + return Math.Sign(Vector3.Dot(t.forward, portalDriverTransform.position - t.position)); } } } diff --git a/Assets/Escape Room Engine/Portal/Portal.mat b/Assets/Escape Room Engine/Portal/Portal.mat index 527097a..edcf1d9 100644 --- a/Assets/Escape Room Engine/Portal/Portal.mat +++ b/Assets/Escape Room Engine/Portal/Portal.mat @@ -44,6 +44,10 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _LeftTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _MainTex: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -60,6 +64,10 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _RightTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _SpecGlossMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -109,6 +117,7 @@ Material: - _SrcBlend: 1 - _Surface: 0 - _WorkflowMode: 1 + - _ZTest: 4 - _ZWrite: 1 m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Escape Room Engine/Portal/Portal.prefab b/Assets/Escape Room Engine/Portal/Portal.prefab index ab5a902..02ba705 100644 --- a/Assets/Escape Room Engine/Portal/Portal.prefab +++ b/Assets/Escape Room Engine/Portal/Portal.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 2246995198243242195} - component: {fileID: 1249363658} + - component: {fileID: 7604291350124895408} m_Layer: 0 m_Name: Portal m_TagString: Untagged @@ -29,9 +30,9 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 8885472774183339771} + - {fileID: 4697416823958963037} + - {fileID: 9135323956734471646} - {fileID: 2398425302420252226} - - {fileID: 2168933888955393262} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -47,91 +48,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ae59cddbf8fa37549bb38b1039feeb34, type: 3} m_Name: m_EditorClassIdentifier: - other: {fileID: 0} + linkedPortal: {fileID: 0} portalCamera: {fileID: 17691322601746172} ---- !u!1 &6911937082098131204 -GameObject: +--- !u!65 &7604291350124895408 +BoxCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 8885472774183339771} - - component: {fileID: 1178153191156473883} - - component: {fileID: 6216133567950691622} - m_Layer: 0 - m_Name: Quad - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &8885472774183339771 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6911937082098131204} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: 0} - m_LocalScale: {x: 1, y: 2, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 2246995198243242195} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &1178153191156473883 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6911937082098131204} - m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &6216133567950691622 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6911937082098131204} + m_GameObject: {fileID: 5635962022185625128} + m_Material: {fileID: 0} + m_IsTrigger: 1 m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 603cda73335499d4980d9b171eaffe0d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} + serializedVersion: 2 + m_Size: {x: 1, y: 2, z: 0.1} + m_Center: {x: 0, y: 1, z: -0.05} --- !u!1 &7398326895463990628 GameObject: m_ObjectHideFlags: 0 @@ -164,7 +95,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2246995198243242195} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &7791795762741173939 Camera: @@ -254,10 +185,61 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ad60e3973ab83f3468637a06970d7f1f, type: 3} m_Name: m_EditorClassIdentifier: - minNearClipPlane: 0.02 + minNearClipPlane: 0.0001 portal: {fileID: 1249363658} - portalQuad: {fileID: 6216133567950691622} ---- !u!1001 &1842852527293547269 + screen: {fileID: 5871497001431693362} +--- !u!1001 &5096432983393035446 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2246995198243242195} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 603cda73335499d4980d9b171eaffe0d, type: 2} + - target: {fileID: 919132149155446097, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + propertyPath: m_Name + value: Portal Screen + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 45a0860e0db749d4881818b0d8d3d0b4, type: 3} +--- !u!4 &4697416823958963037 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + m_PrefabInstance: {fileID: 5096432983393035446} + m_PrefabAsset: {fileID: 0} +--- !u!23 &5871497001431693362 stripped +MeshRenderer: + m_CorrespondingSourceObject: {fileID: -7511558181221131132, guid: 45a0860e0db749d4881818b0d8d3d0b4, + type: 3} + m_PrefabInstance: {fileID: 5096432983393035446} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &8740793916703066677 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -267,7 +249,7 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} @@ -287,22 +269,22 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} propertyPath: m_LocalRotation.w - value: 0.0000031292439 + value: 0.7071067 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} propertyPath: m_LocalRotation.x - value: -0 + value: 0.7071068 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} propertyPath: m_LocalRotation.y - value: -1 + value: 0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} propertyPath: m_LocalRotation.z - value: -0 + value: 0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} @@ -312,7 +294,7 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: -180 + value: 0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} @@ -326,9 +308,9 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} ---- !u!4 &2168933888955393262 stripped +--- !u!4 &9135323956734471646 stripped Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: a2052daf99b37934fb434aaffa9e75f2, type: 3} - m_PrefabInstance: {fileID: 1842852527293547269} + m_PrefabInstance: {fileID: 8740793916703066677} m_PrefabAsset: {fileID: 0} diff --git a/Assets/Escape Room Engine/Portal/PortalCamera.cs b/Assets/Escape Room Engine/Portal/PortalCamera.cs index 7a3c53a..268309e 100644 --- a/Assets/Escape Room Engine/Portal/PortalCamera.cs +++ b/Assets/Escape Room Engine/Portal/PortalCamera.cs @@ -10,7 +10,6 @@ namespace Escape_Room_Engine.Portal [RequireComponent(typeof(Camera))] public class PortalCamera : MonoBehaviour { - private static readonly Matrix4x4 HalfRotation = Matrix4x4.Rotate(Quaternion.Euler(0, 180, 0)); private static readonly Camera.StereoscopicEye[] Eyes = { Camera.StereoscopicEye.Left, Camera.StereoscopicEye.Right }; private static readonly Dictionary EyeTextureNames = new() @@ -22,15 +21,15 @@ namespace Escape_Room_Engine.Portal /// /// The minimum near clip plane distance to be used when calculating the oblique clip plane. /// - public float minNearClipPlane = 0.02f; + public float minNearClipPlane = 0.0001f; /// /// The portal this camera renders through. /// [SerializeField] private Portal portal; /// - /// The quad where the rendered texture will be drawn on. + /// The mesh where the rendered texture will be drawn on. /// - [SerializeField] private MeshRenderer portalQuad; + [SerializeField] private MeshRenderer screen; private PlayerCamera _playerCamera; private Camera _camera; @@ -56,16 +55,18 @@ namespace Escape_Room_Engine.Portal RenderPipelineManager.beginCameraRendering -= Render; } - private void Render(ScriptableRenderContext scriptableRenderContext, Camera camera) + private void Render(ScriptableRenderContext scriptableRenderContext, Camera _) { // check whether the portal plane is visible from the player camera var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(_playerCamera.camera); - if (!GeometryUtility.TestPlanesAABB(frustumPlanes, portal.other.portalCamera.portalQuad.bounds)) + if (!GeometryUtility.TestPlanesAABB(frustumPlanes, portal.linkedPortal.portalCamera.screen.bounds)) // don't render this portal if it is not visible return; var t = portal.transform; + screen.enabled = false; + foreach (var eye in Eyes) { // create portal texture if it doesn't exist yet @@ -75,15 +76,15 @@ namespace Escape_Room_Engine.Portal { _textures.Add(eye, new RenderTexture(XRSettings.eyeTextureWidth, XRSettings.eyeTextureHeight, 24)); - portal.other.portalCamera.portalQuad.material.SetTexture(EyeTextureNames[eye], _textures[eye]); + portal.linkedPortal.portalCamera.screen.material.SetTexture(EyeTextureNames[eye], _textures[eye]); } else // no texture was created so nothing should be rendered continue; } // position portal camera - var m = t.localToWorldMatrix * HalfRotation * portal.other.transform.worldToLocalMatrix * - _playerCamera.getEyeTransform(eye).localToWorldMatrix; + var m = t.localToWorldMatrix * Portal.HalfRotation * portal.linkedPortal.transform.worldToLocalMatrix * + _playerCamera.GetEyeTransform(eye).localToWorldMatrix; transform.SetPositionAndRotation(m.GetPosition(), m.rotation); _camera.projectionMatrix = _playerCamera.camera.GetStereoProjectionMatrix(eye); @@ -93,7 +94,7 @@ namespace Escape_Room_Engine.Portal var portalPlane = new Plane(n, t.position); // clip plane in world space var clipPlane = _camera.worldToCameraMatrix.inverse.transpose * new Vector4(n.x, n.y, n.z, portalPlane.distance); // vector format clip plane in camera space - if (Math.Abs(portalPlane.GetDistanceToPoint(transform.position)) >= minNearClipPlane) + if (-portalPlane.GetDistanceToPoint(transform.position) >= minNearClipPlane) // only adjust the near clip plane if it doesn't intersect with the camera _camera.projectionMatrix = _camera.CalculateObliqueMatrix(clipPlane); @@ -101,6 +102,8 @@ namespace Escape_Room_Engine.Portal _camera.targetTexture = _textures[eye]; UniversalRenderPipeline.RenderSingleCamera(scriptableRenderContext, _camera); } + + screen.enabled = true; } } } diff --git a/Assets/Escape Room Engine/Portal/PortalDriver.cs b/Assets/Escape Room Engine/Portal/PortalDriver.cs new file mode 100644 index 0000000..76293d0 --- /dev/null +++ b/Assets/Escape Room Engine/Portal/PortalDriver.cs @@ -0,0 +1,38 @@ +using System; +using UnityEngine; + +namespace Escape_Room_Engine.Portal +{ + [RequireComponent(typeof(Collider), typeof(Rigidbody))] + public class PortalDriver : MonoBehaviour + { + /// + /// The object that will be transported through the portal. Usually either this object or a parent offset object. + /// + [SerializeField] private Transform traveller; + + /// + /// The side of the portal this became tracked on. + /// + [HideInInspector] public int entrySide; + + /// + /// A reference to the collider of this portal driver. + /// + public Collider Collider { get; private set; } + + private void Awake() + { + // check whether the collider is set up correctly + Collider = GetComponent(); + if (Collider.isTrigger) throw new Exception("Collider must not be a trigger."); + } + + public void Teleport(Portal from, Portal to) + { + var m = to.transform.localToWorldMatrix * Portal.HalfRotation * from.transform.worldToLocalMatrix * + traveller.localToWorldMatrix; + traveller.transform.SetPositionAndRotation(m.GetPosition(), m.rotation); + } + } +} diff --git a/Assets/Escape Room Engine/Portal/PortalDriver.cs.meta b/Assets/Escape Room Engine/Portal/PortalDriver.cs.meta new file mode 100644 index 0000000..7d14308 --- /dev/null +++ b/Assets/Escape Room Engine/Portal/PortalDriver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1bacec3b1d81cef43972d5dfc26a467b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Test Assets/Interactable.mat b/Assets/Escape Room Engine/Test Assets/Interactable.mat index e81139b..690e6f9 100644 --- a/Assets/Escape Room Engine/Test Assets/Interactable.mat +++ b/Assets/Escape Room Engine/Test Assets/Interactable.mat @@ -119,8 +119,8 @@ Material: - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - _BaseColor: {r: 0.06666667, g: 0.5411765, b: 0.69803923, a: 1} - - _Color: {r: 0.06666665, g: 0.5411765, b: 0.69803923, a: 1} + - _BaseColor: {r: 1, g: 0.81960785, b: 0.4, a: 1} + - _Color: {r: 1, g: 0.81960785, b: 0.39999998, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Escape Room Engine/Test Assets/World A.mat b/Assets/Escape Room Engine/Test Assets/World A.mat new file mode 100644 index 0000000..a83c46d --- /dev/null +++ b/Assets/Escape Room Engine/Test Assets/World A.mat @@ -0,0 +1,126 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7976852360178017470 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: World A + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.06666667, g: 0.5411765, b: 0.69803923, a: 1} + - _Color: {r: 0.06666665, g: 0.5411765, b: 0.69803923, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Escape Room Engine/Test Assets/World A.mat.meta b/Assets/Escape Room Engine/Test Assets/World A.mat.meta new file mode 100644 index 0000000..92c9127 --- /dev/null +++ b/Assets/Escape Room Engine/Test Assets/World A.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aee171c2a9e1c9d43b3f93b3cfc61500 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Test Assets/World B.mat b/Assets/Escape Room Engine/Test Assets/World B.mat new file mode 100644 index 0000000..7c4552d --- /dev/null +++ b/Assets/Escape Room Engine/Test Assets/World B.mat @@ -0,0 +1,126 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7976852360178017470 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: World B + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.9372549, g: 0.2784314, b: 0.43529412, a: 1} + - _Color: {r: 0.9372549, g: 0.27843136, b: 0.4352941, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Escape Room Engine/Test Assets/World B.mat.meta b/Assets/Escape Room Engine/Test Assets/World B.mat.meta new file mode 100644 index 0000000..51ce49c --- /dev/null +++ b/Assets/Escape Room Engine/Test Assets/World B.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 041825dc2cc50844f9aa0075a3004bb1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/PortalScene.unity b/Assets/Scenes/PortalScene.unity index 17eb034..5b635a7 100644 --- a/Assets/Scenes/PortalScene.unity +++ b/Assets/Scenes/PortalScene.unity @@ -256,7 +256,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1199088360} + - {fileID: 1169383893} - {fileID: 7295752538729181700} - {fileID: 2061968364} - {fileID: 1363513912} @@ -845,6 +845,9 @@ GameObject: - component: {fileID: 250613601} - component: {fileID: 250613600} - component: {fileID: 250613604} + - component: {fileID: 250613605} + - component: {fileID: 250613606} + - component: {fileID: 250613607} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -1055,6 +1058,49 @@ MonoBehaviour: camera: {fileID: 250613603} leftEye: {fileID: 49933502} rightEye: {fileID: 1755438915} +--- !u!114 &250613605 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 250613598} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bacec3b1d81cef43972d5dfc26a467b, type: 3} + m_Name: + m_EditorClassIdentifier: + traveller: {fileID: 62537129} + entrySide: 0 +--- !u!135 &250613606 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 250613598} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.05 + m_Center: {x: 0, y: 0, z: 0} +--- !u!54 &250613607 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 250613598} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 0 + m_IsKinematic: 1 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 --- !u!1 &289664350 GameObject: m_ObjectHideFlags: 0 @@ -2812,6 +2858,38 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1023639977} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1169383892 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1169383893} + m_Layer: 0 + m_Name: Test Camera Offset + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1169383893 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1169383892} + 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: + - {fileID: 1199088360} + m_Father: {fileID: 52010741} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1186837739 GameObject: m_ObjectHideFlags: 0 @@ -3055,6 +3133,9 @@ GameObject: - component: {fileID: 1199088359} - component: {fileID: 1199088358} - component: {fileID: 1199088361} + - component: {fileID: 1199088362} + - component: {fileID: 1199088363} + - component: {fileID: 1199088364} m_Layer: 0 m_Name: Test Camera m_TagString: MainCamera @@ -3085,7 +3166,7 @@ Camera: y: 0 width: 1 height: 1 - near clip plane: 0.3 + near clip plane: 0.01 far clip plane: 1000 field of view: 60 orthographic: 0 @@ -3153,16 +3234,16 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1199088356} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0, y: 1.193, z: -2.275} + m_LocalRotation: {x: 0.0697579, y: -0, z: -0, w: 0.99756396} + m_LocalPosition: {x: 0, y: 1.193, z: -2.275} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 195513902} - {fileID: 817509151} - m_Father: {fileID: 52010741} + m_Father: {fileID: 1169383893} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 8, y: 0, z: 0} --- !u!114 &1199088361 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3178,6 +3259,49 @@ MonoBehaviour: camera: {fileID: 1199088357} leftEye: {fileID: 195513902} rightEye: {fileID: 817509151} +--- !u!114 &1199088362 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199088356} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bacec3b1d81cef43972d5dfc26a467b, type: 3} + m_Name: + m_EditorClassIdentifier: + traveller: {fileID: 1169383893} + entrySide: 0 +--- !u!135 &1199088363 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199088356} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.05 + m_Center: {x: 0, y: 0, z: 0} +--- !u!54 &1199088364 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199088356} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 0 + m_IsKinematic: 1 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 --- !u!1 &1274381185 GameObject: m_ObjectHideFlags: 0 @@ -3195,7 +3319,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &1274381186 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3258,15 +3382,29 @@ PrefabInstance: propertyPath: camera value: objectReference: {fileID: 0} + - target: {fileID: 1249363658, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} + propertyPath: linkedPortal + value: + objectReference: {fileID: 7295752538729181702} - target: {fileID: 1249363658, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: playerCamera value: objectReference: {fileID: 1199088357} + - target: {fileID: 1889810494552553078, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 041825dc2cc50844f9aa0075a3004bb1, type: 2} - target: {fileID: 2246995198243242195, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: m_RootOrder value: 0 objectReference: {fileID: 0} + - target: {fileID: 2246995198243242195, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.001 + objectReference: {fileID: 0} - target: {fileID: 2246995198243242195, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: m_LocalRotation.w @@ -3302,11 +3440,26 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2708038842397463387, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 041825dc2cc50844f9aa0075a3004bb1, type: 2} - target: {fileID: 5635962022185625128, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: m_Name value: Portal 2 objectReference: {fileID: 0} + - target: {fileID: 7579483879678998835, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 041825dc2cc50844f9aa0075a3004bb1, type: 2} + - target: {fileID: 7965773041589933745, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 041825dc2cc50844f9aa0075a3004bb1, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} --- !u!4 &1281318075 stripped @@ -3394,7 +3547,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: aee171c2a9e1c9d43b3f93b3cfc61500, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -3755,7 +3908,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: 041825dc2cc50844f9aa0075a3004bb1, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -3896,7 +4049,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: 041825dc2cc50844f9aa0075a3004bb1, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -4329,7 +4482,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: aee171c2a9e1c9d43b3f93b3cfc61500, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -4604,15 +4757,29 @@ PrefabInstance: propertyPath: camera value: objectReference: {fileID: 1199088357} + - target: {fileID: 1249363658, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} + propertyPath: linkedPortal + value: + objectReference: {fileID: 1281318076} - target: {fileID: 1249363658, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: playerCamera value: objectReference: {fileID: 1199088357} + - target: {fileID: 1889810494552553078, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: aee171c2a9e1c9d43b3f93b3cfc61500, type: 2} - target: {fileID: 2246995198243242195, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} + - target: {fileID: 2246995198243242195, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.001 + objectReference: {fileID: 0} - target: {fileID: 2246995198243242195, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -4628,11 +4795,26 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2708038842397463387, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: aee171c2a9e1c9d43b3f93b3cfc61500, type: 2} - target: {fileID: 5635962022185625128, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} propertyPath: m_Name value: Portal 1 objectReference: {fileID: 0} + - target: {fileID: 7579483879678998835, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: aee171c2a9e1c9d43b3f93b3cfc61500, type: 2} + - target: {fileID: 7965773041589933745, guid: c50e7df1078c96f46bc6825f7e422fb7, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: aee171c2a9e1c9d43b3f93b3cfc61500, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c50e7df1078c96f46bc6825f7e422fb7, type: 3} --- !u!4 &7295752538729181700 stripped diff --git a/Assets/URP/URP-HighFidelity-Renderer.asset b/Assets/URP/URP-HighFidelity-Renderer.asset index 90883f9..6e4d296 100644 --- a/Assets/URP/URP-HighFidelity-Renderer.asset +++ b/Assets/URP/URP-HighFidelity-Renderer.asset @@ -12,7 +12,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f62c9c65cf3354c93be831c8bc075510, type: 3} m_Name: SSAO m_EditorClassIdentifier: - m_Active: 1 + m_Active: 0 m_Shader: {fileID: 4800000, guid: 0849e84e3d62649e8882e9d6f056a017, type: 3} m_Settings: Downsample: 0 @@ -59,7 +59,7 @@ MonoBehaviour: type: 3} objectMotionVector: {fileID: 4800000, guid: 7b3ede40266cd49a395def176e1bc486, type: 3} - m_AssetVersion: 1 + m_AssetVersion: 2 m_OpaqueLayerMask: serializedVersion: 2 m_Bits: 4294967295 @@ -76,6 +76,7 @@ MonoBehaviour: m_ShadowTransparentReceive: 1 m_RenderingMode: 0 m_DepthPrimingMode: 0 + m_CopyDepthMode: 0 m_AccurateGbufferNormals: 0 m_ClusteredRendering: 0 m_TileSize: 32 diff --git a/Assets/URP/URP-HighFidelity.asset b/Assets/URP/URP-HighFidelity.asset index 6248100..f2249d5 100644 --- a/Assets/URP/URP-HighFidelity.asset +++ b/Assets/URP/URP-HighFidelity.asset @@ -39,7 +39,7 @@ MonoBehaviour: m_AdditionalLightsShadowResolutionTierHigh: 512 m_ReflectionProbeBlending: 1 m_ReflectionProbeBoxProjection: 1 - m_ShadowDistance: 150 + m_ShadowDistance: 10 m_ShadowCascadeCount: 4 m_Cascade2Split: 0.25 m_Cascade3Split: {x: 0.1, y: 0.3}