Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Interesting, is there any game development context? – AttackingHobo Aug 6 '11 at 17:47
it's just exploratory for now, but ultimately, yes. – bitcruncher Aug 6 '11 at 18:23
Until you add some kind of game development context, I am going to vote to close for being off topic. – AttackingHobo Aug 6 '11 at 19:09
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. – Lars Viklund Aug 6 '11 at 22:51
4 axes of rotation? You're kidding right? – subb Aug 7 '11 at 6:35
up vote 5 down vote accepted

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.

share|improve this answer
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. – Mikael Öhman Aug 6 '11 at 23:14
@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. – Maik Semder Aug 6 '11 at 23:28
Thanks for a very thorough answer. Actually, what was most fascinating was the sheer number of games/projects in place since the early 90s. – bitcruncher Aug 7 '11 at 3:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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