# I 3D space curvature visualization

Tags:
1. Apr 10, 2016

I want to program space curvature vizualizaion. I want to have an observer as a player that moves in 3d curved space and surrounding objects that will show curvature by distortion when player passes near them. I am concerned about some points:
1. What curvature to choose in order to experience curvature best?
2. What structures better to take to represent curvature? Maybe I take curvelinear coordinates and translate points to them from cartesian and back?
3. AFAIK riemannian space has local reference frame that changes from point to point. So can I use a function to transform frame when passing points and display all objects points considering local frame transformation?
Notes:
I want to consider time to be newtonian. And as I understand, curvature must be intrinsic without embedded spaces

Thanks.

2. Apr 10, 2016

### stevendaryl

Staff Emeritus
That's an interesting project. When you say that you want to show distortion of objects, are you saying that the distortion is to be caused by the bending of light rays?

It might be a good warmup to do it in 2d first, and to take a simple curved surface such as a sphere. On the other hand, what things look like on a sphere (when the light rays are confined to travel along the surface) has more going on than simple distortion. There is also the fact that there can be more than one "straight" lines through two points. For example, if you are sitting at the South Pole, you would see the North Pole not as a point, but as a circle surrounding you, because every direction you look, you'll see the north pole.

3. Apr 10, 2016

Yes, but excepting light bending I also thought there would be curved metrics i.e. distorted lengths, so observer who is out a curved region would see curved lengths there. Or does that effect appear purely because of light bending?
I thought I would do so. Also on 2d curved light paths would be observed obviously
That would be a great effect. But what I was thinking about is to make a space with different curved regions, some of them might be flat

4. Apr 10, 2016

### stevendaryl

Staff Emeritus
Well, what you see when you look at an object is not actually the length. The sensation of length of an object is due to the angle subtended by the object. That is, you draw a straight line (or geodesic, in curved space) from one end of the object to your eye. Then you draw a straight line from the other end to your eye. These two lines meet at your eye. The angle between the two lines determines how big the object looks to you.

So you don't actually need to consider the metric independently of the paths of the light rays. The light rays by themselves determine how big objects look.

5. Apr 10, 2016

I come up with another question. What metric must there be to observe straight line as an arc?

6. Apr 12, 2016

OK, guys. Since no one can answer my latest question, could you direct me to the answer?

Last edited: Apr 12, 2016
7. Apr 12, 2016

### stevendaryl

Staff Emeritus
I'm not sure I understand the question. When you say "observe straight line as an arc", what definition of "straight line" are you using, and what definition of "arc" are you using, and what definition of "observe" are you using?

In Euclidean space, a "straight line" is the shortest path connecting two points. On a curved surface such as a sphere, that shortest path would be a curve, not a straight line (you can't travel in a straight line while remaining on the sphere).

8. Apr 13, 2016

I mean kind of a situation:
Let's suppose you and a straight line are in flat region of space. You observe it straight, that's ok.Then you go to curved region and take the line with you and place it there. And now you see the line is an arc or another curve. What can the metric of this region be in order light to do such bending?
Note: let's say that's in 2D and you are kind of a flatlander

9. Apr 14, 2016

### zinq

Here's how I would visualize a curved space — from within that space:

For simplicity I'll address the case of a Riemannian 3-manifold. And I'll assume that we can figure out the shortest geodesics between any two points.

To visualize anything in a space, we need to have something in that space. So let's assume our 3-manifold is called M, and suppose that we want to visualize a certain subset of M that we will call X — our scene.

I) At each moment of time:
-----
a) Our eye will need to be located at some specific point P in M.

b) At that point P, we will need to also know in what direction away from that point are we looking. This will be some tangent vector v ∈ TP(M).

c) Given P and v, there are 360º worth of directions perpendicular to v that might be our vertical direction. This will be defined by some vector u ∈ TP(M) (u for "up") satisfying

<u, v> = 0.​

Then (P, V, u) completely determine the camera position P and orientation at P.
-----

II) Now we need some way to map the scene X onto our computer screen. But for simplicity we will first map it onto the unit sphere S2 in the tangent space TP(M):

S2 = {w ∈ TP(M) | ||w|| = 1}.​

Here's what we do: For each point w of S2, we need to imagine extending the unique geodesic from P in the direction of w until it first reaches some point Q of the scene X.

III) We also need to have some source or sources of light. Typically these are at some fixed location in our space M, but for sure they are at some fixed location at any moment of time.

IV) We also need to have decided on the surface characteristics of the scene X, meaning how it reflects light at each of its boundary points. Typically these are some combination of a) specular and b) diffuse reflection, with some color being assigned to the diffuse reflection.

V) Our geodesic from P in the direction of w has first reached X at its point Q. At this stage we need to calculate the color and intensity of the light that will be reflected by X at Q back in the direction of that geodesic from P to Q, except of course in the reverse direction.

VI) Then that color at that intensity will be what the viewer will see — but wait, we still have to identify our screen rectangle with some portion of the sphere S2 of unit tangent vectors at P. There are many ways to do this, but normally it's most important that the portion of S2 identified with the screen rectangle have the horizontal (longer) direction of the rectangle identified with a comfortable viewing angle in S2. This should be around 70º, that is, from 35º to the left of straight ahead to 35º to the right of straight ahead.

Using this identification, we know how to display the correct color and intensity at each point of the screen.

Note 1: Of course, we don't need to calculate any geodesics that don't pass through the screen rectangle, since they won't be displayed.
And, this writeup has done things a bit backwards, since it makes the most sense to go pixel by pixel on our screen first, then to figure out what color that pixel should be displaying. But I'll leave that part to you.

Note 2: Since this is obviously a complicated procedure, it would make the most sense to start with a very simple case for M, like letting M be the 3-sphere (the unit sphere S3 in 4-space):

S3 = {x ∈ R4 | ||x|| = 1}.

In S3, all geodesics are great circles, and the sectional curvature is always equal to 1. Which makes things considerably simpler than for a general Riemannian manifold.

Note 3: Some general software has already been written to visualize sufficiently simple scenes in sufficiently simple Riemannian manifolds. You may want to check out the freely downloadable Geomview at http://www.geomview.org.

10. Apr 15, 2016

zinq, thank you for such detailed answer. I intend to make the project in a game engine such as Unity3D. There you already have scene and light and you can easily put any object to scene. But the scene is euclidian space there, so I think to take it as a tangent space in player position. So I try to find out how to translate vertices in scene to show notion of being located in 3-manifold. Any ideas of such transformation?

11. Apr 15, 2016

### zinq

The easiest way to do that might be if you decided that the 3-manifold you want to use is the 3-torus T3. T3 is defined as what you get by identifying the 6 faces of a (say unit) cube [0,1]3 by imagining that

(0, y, z) ~ (1, y, z);​

(x, 0, z) ~ (x, 1, z); ​

(x, y, 0) ~ (x, y, 1),​

for all x, y, z in the closed interval [0, 1]. Here P ~ Q means that P and Q are to be considered the same point in T3.

The bad news is that T3 has zero curvature: a small piece of it is isometric to a small piece of Euclidean 3-space R3.

But the good news is that it's a very interesting space: If you go far enough in the x, y, or z directions (as well as many others), you end up where you started! In fact, if you look straight ahead you may be able to see the back of your head. So that should be fun to program. And it would make a very interesting setting for a game.

12. Apr 15, 2016

Good idea! I'll take it to consideration. Any ideas for non-zero curvature?

13. Apr 15, 2016

### zinq

Just one simplest example, if you want a 3-manifold. Since the 3-sphere S3 cannot even be placed in 3-space R3 so that it is merely topologically accurate, let's forget about S3 per se. (In general, no n-manifold without boundary exists as a topologically correct subset of Rn.)

But a hemisphere of S3 — let's call it H — does exist homeomorphically in R3, though distorted. A nice way to do this that preserves all angles, though not most distances, is by a stereographic projection map from S3 - {N} into R3, but just applied to H.

Here S3 will specifically denote the unit sphere

S3 = {(x, y, z, w) ∈ R4 | x2 + y2 + z2 + w2 = 1},​

N denotes (0, 0, 0, 1) ∈ S3,

and H will denote the hemisphere:

H = {(x,y,z,w) ∈ S3 | w ≤ 0}.​

The formula for stereographic projection

st: S3 - {N] → R3

is given by

st(x, y, z, w) = (x/(1-w), y-(1-w), z/(1-w)).​

(Note that the denominators 1-w are never 0, because w = 1 only at the point N of S3. )

The mapping st carries H homeormorphically, in fact diffeomorphically, onto the unit ball B3 about the origin in R3:

st(H) = B3.​

However, most of the straight lines in B3 are not the images of geodesics (the equivalent of straight lines) in H ⊂ S3. You're interested in geodesics because, or course, those are the paths that light rays would take. I'll leave it to you to figure out which curves in H are the images by st of geodesics in H (which are all great circles there).

Because H, like S3, has constant (sectional) curvature of K = 1, this is probably the simplest 3D examples with nonzero curvature, in R3, that you could consider.

Good luck!

14. Apr 16, 2016

And what is the curvature on this video and how can one to describe those transformtions?
On 3:17 and 4:26

15. Apr 30, 2016

Friends, there is no answer for a long. Please give me some clues
On 3:17 in the previous video as I see the metric is $g=g(x)$ where x is position vector. So if at start point the metric is
\begin{pmatrix}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix}
later it can become
\begin{pmatrix}
0.5 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
0.25 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix}
and on. That is it changes in one direction. Am I right?

But what it is on 4:26 I have barely an idea