diff --git a/Assets/Escape Room Engine/Portal/Portal.cs b/Assets/Escape Room Engine/Portal/Portal.cs index 0d648b7..6a8ddcf 100644 --- a/Assets/Escape Room Engine/Portal/Portal.cs +++ b/Assets/Escape Room Engine/Portal/Portal.cs @@ -60,6 +60,12 @@ namespace Escape_Room_Engine.Portal private void Render(ScriptableRenderContext scriptableRenderContext, Camera camera) { + // check whether the portal plane is visible from the player camera + var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(_playerCamera.camera); + if (!GeometryUtility.TestPlanesAABB(frustumPlanes, other.portalQuad.bounds)) + // don't render this portal if it is not visible + return; + var t = transform; foreach (var eye in Eyes)