Unity Marathon clones

Chat and discussion not related to either Marathon or Aleph One. Please keep things at least mildly interesting, though.
Post Reply
Qweasy908
Cyborg
Posts: 86
Joined: Jul 18th '18, 22:45

I'd like for more Marathon clones to exist.

Unity has two built in ways to do visibility tests with portal rendering.


Plane and AABB.

1: Add planes to the main camera with GeometryUtility.CalculateFrustumPlanes.
2: Find the portals renderer bounds with GeometryUtility.TestPlanesAABB.
3: Make portals find other portals by adding planes to portal edges and the main camera.
4: The portal vertices and main camera are in world space.
5: Make a shader that uses planes to clip sectors.


Overlapping rects.

1: Change the portals vertices to screen space.
2: Find the min max of the portals vertices x and y to make a rect with Rect.MinMaxRect.
3: Use Rect.Overlaps to check for visible portals.
4: Keep the rect on screen by clipping it to the bounds of the screen.
5: Make a shader that clips sectors to the portal rect.


Portals can only test the visibility of a sectors list of portals.

Use breadth first search starting with the root sector then check portals for other visible sectors by putting portal sectors in a queue.
Use GameObject.SetActive true if sectors are on a list and set active false if a sector is not.
Use Graphics.DrawMesh to render a sector for each portal and clip the sector to the portal.
Use MaterialPropertyBlock to set the vectors for the clipping shader.
Use point in polyhedron by adding planes to each triangle in a sector and portal mesh then check if player is in neighboring sectors.
Use Plane.GetDistanceToPoint to check for backwards facing portals with main camera point or else an endless loop will happen.
Post Reply