As a mental exercise, I'm trying to imagine projecting an arbitrary 4D mesh onto the screen (2D).

I'm guessing a single 4D triangle would still consist of only 3 points, however each of those 3 points would be defined by column with 4 dimensions.

Would it make more sense to define a projection matrix to map 4D space to 3D space first and then have OpenGL do its own projection from that data to 2D space?

Or would it be best to just plan on projecting down from 4 to 2 directly?

Many thanks.

  • \$\begingroup\$ Interesting, is there any game development context? \$\endgroup\$ – AttackingHobo Aug 6 '11 at 17:47
  • \$\begingroup\$ it's just exploratory for now, but ultimately, yes. \$\endgroup\$ – bitcruncher Aug 6 '11 at 18:23
  • \$\begingroup\$ Until you add some kind of game development context, I am going to vote to close for being off topic. \$\endgroup\$ – AttackingHobo Aug 6 '11 at 19:09
  • \$\begingroup\$ As a side note, the homogeneous coordinates that graphics APIs deal with are a special kind of 4D space, in which all points on a line through the origin are considered the same point in 3D. That is, <kx,ky,kz,k> is the same point <x,y,z> for all k. \$\endgroup\$ – Lars Viklund Aug 6 '11 at 22:51
  • \$\begingroup\$ 4 axes of rotation? You're kidding right? \$\endgroup\$ – subb Aug 7 '11 at 6:35

The multidimensional generalization of a triangle is an N-Simplex, here is a video of a projection of such an object. Here is another interesting video of a 4D hypercube.

This wiki page is a good starting point if you want to learn more about the fourth dimension and how to visualize such objects. It also links a wiki page with a list of 4D games.

Regarding your question about the projection: This paper explains the math of orthographic and perspective projection matrices for higher dimensions. Another great paper is Four-Space Visualization of 4D Objects by Steven Richard Hollasch. Particularly the paragraph "4.1: High-Level Overview of 4D to 2D Projection" answers your projection question in detail and comes with source code.

Finally here is an N-dimensional renderer using OpenGL coming with full source code.

  • \$\begingroup\$ I'm not sure why you would treat a triangle like that. Just as a 3D mesh contain a triangle (as opposed to tetrahedrons), a 4D mesh can contain 2D shapes like a triangle. \$\endgroup\$ – Mikael Öhman Aug 6 '11 at 23:14
  • \$\begingroup\$ @Mikael, just because of the mental exercise of the question, it would be more interesting to use a 4D generalization of a 2D triangle,'the rotation of such an object looks awesome. However, you are right, one could use a simple triangle in 4D space. \$\endgroup\$ – Maik Semder Aug 6 '11 at 23:28
  • \$\begingroup\$ Thanks for a very thorough answer. Actually, what was most fascinating was the sheer number of games/projects in place since the early 90s. \$\endgroup\$ – bitcruncher Aug 7 '11 at 3:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.