True Non-Euclidean Space

Can a truly non-Euclidean space be implemented in Unity (using unlit shaders)?

For example, on a spherical surface, from the perspective of the camera I can see an object in front of me, and as I approach it, it becomes larger. However, once I pass the object, the object is now translated to its maximum distance from my current position, only it is still in my forward view. Thus, there is no perception of local curvature; the world appears flat from the camera’s perspective, but the perception of distance and angle is manipulated to be consistent with non-Euclidean properties.

I am deliberately excluding examples such as Portal, and cases that involve portals, because these are more accurately described as impossible spaces, and do not have a single veridical representation that can be assessed as accurate or not.

To my knowledge, no, you can’t use true non-euclidean space. However, there are two ways I can think of to simulate it.

The first way is to use a shader. This seems to be what you were asking in actuality, but it’s not true non-euclidean space. Rather, everything would exist in euclidean space, and would just appear to be non-euclidean. For example, let’s take translating euclidean to spherical space. You’d want to use a sphere instead of any actual planes in order for things to look normal, then you’d have to warp each asset such that with the offset through the translation, the mesh still looks normal. You’d then make a sphere without a collider, and make it as big as the world space is. You’d then want to write a volumetric shader which skews light such that it rotates around the center of the object. This should provide the effect you’re looking for, but it would be a pain in the neck to manage. You’d need to mess with the rotation of the character a ton, and manually make gravity. It would be tricky to work with, because all of the Unity methods still operate in euclidean space, and you’d be effectively working in spherical space.

The other way to make this effect is just to simulate it. There’s a bunch of jumping through hoops that you’d have to do, but essentially, here’s the rundown. Create a floor plane with the edges surrounded by wall planes orthogonal to the first plane with render textures on them. Attach a camera to the center of each bordering plane and slightly in front, then bind the render texture of each plane to the camera on the opposite plane. You’ll have to mess with the FOV until it looks right on them. Next, just attach a script so that if anything interactive collides with a plane, it’s transported to the opposite side. There, now you have a simulation of spherical space in euclidean space.

Now this method isn’t perfect (for example, perpendicular lines still don’t intersect), but it’s a good start. You can’t make truly non-euclidean space in an engine built for euclidean space, simple as that. Note that, as with truly spherical space, this would show the objects repeating infinitely into the distance. Anyway, hope this helps!!!

EDIT: Two extra things I thought of, the wall planes should be infinitely high, and they should actually not be planes, but rather, cubes which extend into the space you can’t enter. Just make sure to include the objects distance from the surface when determining where to teleport it.

Your description sounds a bit strange and is missing some facts. Since a spherical space wraps around itself you’re missing the fact that you’ll see endless versions of your object, not just one. If you stand right beside your object you can also see it at n*2*R*PI distance where n is a whole number. You can’t really render such an infinite space. You can unroll it and render some iterations. However a sherical space viewed as infinite linear space has extreme distortions near the center and at a higher distance above your “surface”.

In your linear space up and down would represent going along the a ray that starts at the center of your sphere. Once you reach the center you can’t go further down. At the center you actually have a singularity. Likewise you have a singularity at n*R*PI for any whole number n (which is half the distance around the sphere) So if you stick a pole into the other side of the sphere you would see it wrapped around the horizon, no matter in what direction you look.

Keep in mind that for example a box in the spherical space would need to have a reversed frustum shape (where the focal point is the sphere’s center) in order to appear like a cube in the linear projection. Also keep in mind that any rotation that is not around the sphere’s normal axis will heavily distort the object. This effect get’s worse the farther you get from the surface of your sphere

What would be the purpose of such a space? As far as i know the space you describe is actually also an euclidean space. Like the a N-Sphere space. In an elliptic or hyperbolic space (which are actual non-Euclidean spaces) you don’t get those features you were talking about. You don’t get back to where you started in those spaces.

I use Vertex Shader to relocate all vertices according to elliptic geometry:

alt text