/-/S'pht-Translator-Active/-/


Unity can do 5D space
Posted By: ZeruhtaeusDate: 5/26/20 6:30 a.m.

I've got a way to make 5D space in Unity.
It involves stencil buffer portals and layers.
Multiple cameras and teleporting are not used.
The maps don't have to be changed to work.
There is only one camera.

This youtube video shows how stencil buffer portals work.
https://www.youtube.com/watch?v=OBb4iUiXaRA

Most Marathon maps have overlapping areas that can be separated into two or more.
The two areas and portals are separate game objects.
The game objects areas are different layers.
There is layer space 1 and layer space 2.
Both layers cannot collide or interact with one another.
The layers can collide and interact with layer default.

Unity shows how to make layers.
https://docs.unity3d.com/Manual/Layers.html
https://docs.unity3d.com/Manual/LayerBasedCollision.html

Two polygons that exist in the same space at the same time are separated using the stencil buffer and layers.
There is a write and a read shader.
The write shader is for the portals and the read shader is for the two overlapping game objects.
Portals hide the overlapping geometry by only rendering what game object is behind the portal.
One portal and area is reference 1 and the other is reference 2.
Portal 1 can only render area 1.

Ronja shows how the stencil buffer works.
https://www.ronja-tutorials.com/2018/08/18/stencil-buffers.html

Unity manual for the stencil buffer.
https://docs.unity3d.com/Manual/SL-Stencil.html

The portals change the player layer when the player crosses a portal.
If the player enters a portal then the player layer is changed from default to layer space 1.
If the player exits a portal then the player layer is changed back to default.

Unity shows how to change layers with script.
https://docs.unity3d.com/ScriptReference/GameObject-layer.html

The portals have box colliders.
Ontriggerstay with crossing the portal does two things for the player, it changes the player game object layer and it changes the area read shader comp to always or equal.
When the player camera crosses the portal plane and enters the area, the read shader comparison is changed from equal to always.
When the player exits the sector portal the read shader on the area is changed back to equal.
To hide the enemy, when entering the portal they also have a read shader attached.
Anything that enters a portal is changed to that areas layer and stencil reference value changed to that portals value.

The overlapping space stays separate and only what enters or exits the portals is changed.

The Marathon map editor Weland can be used to export obj map mesh files.
Use blender to add normals and textures, the normals point inward.
Separate the mesh into polygons or areas.
The wall textures start in the upper left corner of the texture.
Scale the map to 0.125 in Unity.

Player values for use with Unity.

Player height: 819.2 / 1024 * 4 = 3.2
Player view height: 614.4 / 1024 * 4 = 2.4
Player radius: 204.8 / 1024 * 4 = 0.8
Step height: 0.333 * 4 = 1.332

1 world unit = 4

[I want to start a Marathon 1 Unity project.]

[ Post a Reply | Message Index | Read Prev Msg | Read Next Msg ]
Pre-2004 Posts

Replies:

Unity can do 5D spaceZeruhtaeus 5/26/20 6:30 a.m.
     Re: Unity can do 5D spaceK-chi 5/26/20 2:27 p.m.
     Re: Unity can do 5D spaceForrest of B.org 5/26/20 9:11 p.m.

[ Post a Reply | Message Index | Read Prev Msg | Read Next Msg ]
Pre-2004 Posts

 

 

Your Name:
Your E-Mail Address:
Subject:
Message:

If you'd like to include a link to another page with your message,
please provide both the URL address and the title of the page:

Optional Link URL:
Optional Link Title:

If necessary, enter your password below:

Password:

 

 

Problems? Suggestions? Comments? Email maintainer@bungie.org

Marathon's Story Forum is maintained with WebBBS 5.12.